>
>
>#!/usr/local/bin/python
>fileobj=open("myfile")
>lines=fileobj.readlines()
>for i in lines:
> print i
># or do something other than "print" the contents of the string variable i
>
>--ronan
>
>>I wish I understood OO programming better :( That looks like gibberish to
>>me.
Well, I was obviously wrong about BASH scripts not understanding 'lines'!
As for the Python gibberish, it is pretty simple (especially if you know
Python :-) ):
fileobj=open("myfile") #the open() function creates a FILE object
and returns it
lines=fileobj.readlines() #one of the methods (aka member
functions) of the FILE object is
#readlines(), this method
creates a list (like an array) of strings, where
#each element in the list is
one line from the file
for i in lines: #Python for-loops iterate through
elements in a list, so on each pass
#through the loop, i is a
"pointer" to one of the strings
print i #print the string that i points
to, on stdout
--ronan
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:55:22 EDT