On Jan 17, 8:47 pm, Hai Vu <[EMAIL PROTECTED]> wrote: > Here is another suggestion: > > col = 2 # third column > filename = '4columns.txt' > third_column = [line[:-1].split('\t')[col] for line in open(filename, > 'r')] > > third_column now contains a list of items in the third column. > > This solution is great for small files (up to a couple of thousand of > lines). For larger file, performance could be a problem, so you might > need a different solution.
Using the maxsplit arg could speed it up a little: line[:-1].split('\t', col+1)[col] -- http://mail.python.org/mailman/listinfo/python-list