En Tue, 13 May 2008 07:28:03 -0300, <[EMAIL PROTECTED]> escribió:

Hi - I have a list returned from popen/readlines, and am wondering how
to go about iterating over each item which was returned (rather than
currently having the whole lot returned).

so far:

f=os.open("./get_hostnames").readlines

returns ['host1 host2 host3 ... hostN\n]'

You meant readlines(), I presume. A file acts as its own iterator:

f=os.open("./get_hostnames")
try:
  for line in f:
    # do something with line
finally:
  f.close()

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to