How about something like this: # No testing, of course myList = [] file = open( 'testfile', 'r' ) for i in file.readlines( ): myList.append( [int(j.strip( )) for j in i.split('\t')] ) -----Original Message----- From: python-list-admin at python.org [mailto:python-list-admin at python.org]On Behalf Of Duncan Smith Sent: Wednesday, April 11, 2001 1:39 PM To: python-list at python.org Subject: Easy question I need to read some data from a file. Each (tab delimited) row corresponds to an array index eg. 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 ... And I need something like, [[0,0,0,0,0,0], [0,1,0,0,0,0], [0,0,1,0,0,0], ...] What's the best way of doing this? Cheers in advance. Duncan Smith -- http://mail.python.org/mailman/listinfo/python-list
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4