Best way to delimit a list?
dannywebster at googlemail.com
dannywebster at googlemail.com
Tue May 13 07:14:16 EDT 2008
On May 13, 11:51 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
>
> 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
Hi - thank you for your reply.
I meant:
f=os.popen("./get_hostnames").readlines()
So f is a list, rather than a file object, of which os.open would have
returned (my initial typo redirected the missive of this post, sorry!)
cheers
More information about the Python-list
mailing list