Arrays in python

Erik Max Francis max at alcyone.com
Sat Sep 2 15:07:02 EDT 2000


Marcus wrote:

> Hello, I am but a beginner in the language and I have a small
> question.
> Python seem to have a strange syntax concerning arrays (atleast for a
> C
> programmer).
> What i wanna do is simply something like:
> 
> array[0] = open("/home/talos/somefile");

Do something like:

    array = []
    array.append(open("/home/talos/somefile"))

> and then be able to use it like so:
> 
> line = array[0].readline;
> print line,;

    line = array[0].readline()
    print line,

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ The hour which gives us life begins to take it away.
\__/ Seneca
    Interstelen / http://www.interstelen.com/
 A multiplayer, strategic, turn-based Web game on an interstellar scale.



More information about the Python-list mailing list