I\'m writing a simple script that is trying to extract the first element from the second column of a .txt input file.
import sys if (len(sys.argv) > 1):
It can be useful to catch the exception an print the offending lines
for line in f: line = line.strip("\n ' '") line = line.split(",") try: print line[1] except IndexError, e: print e print "line =", line raise # if you don't wish to continue