I\'m trying to process a file from the protein data bank which is separated by spaces (not \\t). I have a .txt file and I want to extract specific rows and, from that rows,
Have a look at the CSV library. https://docs.python.org/2/library/csv.html The following code should do the trick
>>> import csv >>> with open('my-file.txt', 'rb') as myfile: ... spamreader = csv.reader(myfile, delimiter=' ', ) ... for row in spamreader: ... print row[3]