Hello Everyone, I'm working with historical earthquake data and I have a tab delimited file. I'm using the csv module with the \t delimiter to denote it's tab separated and it's working fine. I've set things up loike this:
import csv f = open('earthquakes.tsv') r = csv.DictReader(f, delimiter='\t') for row in r: print row['YEAR'] This works fine. But, I am needing to do date addition/subtraction using datetime and so I need these dates as integers. When I try to cast them like this: print int(row['YEAR']) I am told by the interpreter: Traceback (most recent call last): File "analyze.py", line 14, in <module> print int(row['MONTH']) ValueError: invalid literal for int() with base 10: '' What am I doing wrong? Am I not understanding HOW to cast? Thanks, Anthony -- https://mail.python.org/mailman/listinfo/python-list