[Tutor] how does this list comprehension work?
cspears2002 at yahoo.com
Wed Mar 8 18:32:43 CET 2006
I copied this program from Learning Python and got it
to work on Windows XP:
import sys, glob
sys.argv = [item for arg in sys.argv for item in
What the program does is first print the glob and then
a list of everything caught by the glob. For example:
The key to the script is the list comprehension, which
I am having trouble dissecting. How do I go about
trying to figure out how it works?
"I'm the last person to pretend that I'm a radio. I'd rather go out and be a color television set."
"Who dares wins"
-British military motto
"I generally know what I'm doing."
More information about the Tutor