f = open("file.txt", 'r', encoding = "utf-8") f_output = open("file2.txt", 'w', encoding = "utf-8") i = 0 for line in f: a=line.split("\t") try: print(a[2]) except IndexError: print("Empty field at line %s" % str(i)) i += 1 f.close() f_output.close()
