Laurent Rahuel wrote that antar2 wrote: >> following text for example should be considered as a list of lists (3 >> columns and 3 rows), so that when I make the print statement list[0] >> [0], that the word pear appears >> >> >> pear noun singular >> books nouns plural >> table noun singular
File objects are themselves iterable, returning one line per iteration. So a simple approach is: >>> table = [line.split() for line in open('sentences.txt')] >>> table[0][0] 'pear' Jeffrey -- http://mail.python.org/mailman/listinfo/python-list