newbie: strange python problem
Robin Munn
rmunn at pobox.com
Mon Apr 14 16:41:41 EDT 2003
More information about the Python-list mailing list
Mon Apr 14 16:41:41 EDT 2003
- Previous message (by thread): newbie: strange python problem
- Next message (by thread): newbie: strange python problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
maxx <nospam at somedomain.com> wrote: > On Thu, 10 Apr 2003 08:57:04 -0400, Peter Hansen wrote: > >> Check the output of "ls -la /" manually... the first line does >> *not* have more than two items in it... if you were to change >> the first line above to this, it would work, though I suspect >> there is another option to "ls" which would also suppress >> that extra output. >> >>> for line in os.popen('ls -la /').readlines()[1:]: >> >> -Peter > > Right! A simple mistake, but those are the ones you make taking your > first steps in a new programming language. In addition to this, you may have problems if any filenames had spaces in them. See Skip Montanaro's reply to your post for a better solution that would properly handle spaces in filenames. -- Robin Munn <rmunn at pobox.com> http://www.rmunn.com/ PGP key ID: 0x6AFB6838 50FF 2478 CFFB 081A 8338 54F7 845D ACFD 6AFB 6838
- Previous message (by thread): newbie: strange python problem
- Next message (by thread): newbie: strange python problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list