def toIntSafely(d): try: i = int(d) except: i = 0 return i