Arrays in python

Nick Bower nick at nickbower.com
Sun Sep 3 17:39:16 CEST 2000


>
> array[0] = open("/home/talos/somefile");
>
> and then be able to use it like so:

sorry, if i'm reading your question wrong.  but you could consider using
binary files and the struct/array module combination.  Can't remember
exactly, but it goes something like:

arr = array(typecode stuff)
fp = open(....)
arr.fromfile(fp,100)

if you're hooked on ascii files, then fp.readlines() returns a list (as
opposed to array) of the strings that are the lines of fp.

nick




More information about the Python-list mailing list