[NEWBIE] List issue aka: "Why doesn't this code work?"
Emile van Sebille
emile at fenx.com
Fri Feb 8 11:34:22 EST 2002
"Bruce Dykes" <bkd at graphnet.com> wrote in message
news:mailman.1013184014.10227.python-list at python.org...
> Okay, here's my function:
>
> def process_numbers(source_list):
> for number in range(len(source_list)):
> entry = string.split(string.strip(source_list[number]))
> print number, len(entry), entry
>
> Now this function is doing *something*...source_list is a list of
lines
> retrieved via ftp.retrlines(), and this should break each line into
it's own
> list, and it looks like that's what's being printed out:
>
> ['line1', 'header1', 'header2']
> ['line2', 'datum1', 'datum2']
>
> Notice what's missing? I'm expecting to see:
>
> 0 3 ['line1', 'header1', 'header2']
> 1 3 ['line2', 'datum1', 'datum2']
>
> What the heck am I doing wrong here?
If I had to guess, I'd change
def process_numbers(source_list):
to
def XXXprocess_numbers(source_list):
then track down what function is producing the results you're seeing.
--
Emile van Sebille
emile at fenx.com
---------
More information about the Python-list
mailing list