[Tutor] Stuck on Something
Britt Green
britt_green@hotmail.com
Wed, 07 Mar 2001 17:48:32 -0800
>Message: 8 Date: Wed, 7 Mar 2001 01:07:11 -0700 From: David Porter To:
>Python Tutor Subject: Re: [Tutor] Stuck on Something Organization: (a
>Conspiracy)
>
>* Britt Green :
>
> > Hopefully that wasn't too vague. Any suggestions?
>
>#---
>
>import string
>
>raw_dirs = """\ drwxrwx--- 2 restback privftp 512 Mar 6 21:23
>technicolorkitchen drwxrwx--- 2 restback privftp 512 Mar 6 21:58
>theclubhouse drwxrwx--- 2 restback privftp 512 Mar 6 21:07 thirdstreet
>drwxrwx--- 2 restback privftp 512 Feb 27 11:18 thyme"""
>
>dirs = [] raw_dirs = string.split(raw_dirs, '\n') for x in raw_dirs:
>dirs.append(string.split(x)[-1])
>
>print dirs
Okay. I see what you're doing with this. Unfortunately, when I run this I
get this error:
>>>
Traceback (innermost last):
File "C:\Program Files\Python20\Code\anotherftpthing.py", line 22, in ?
dirs.append(string.split(x)[-1])
IndexError: list index out of range
I've been playing with this for the past couple hours, but haven't quite
figured out how to get around this.
Britt
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com