[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
More information about the Python-list mailing list
Fri Feb 8 11:34:22 EST 2002
- Previous message (by thread): [NEWBIE] List issue aka: "Why doesn't this code work?"
- Next message (by thread): [NEWBIE] List issue aka: "Why doesn't this code work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"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 ---------
- Previous message (by thread): [NEWBIE] List issue aka: "Why doesn't this code work?"
- Next message (by thread): [NEWBIE] List issue aka: "Why doesn't this code work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list