Re: [Tutor] optional parameter in list comprehension

2008-12-29 Thread bob gailer
prasad rao wrote: hello! I am a novice looking up to the tutor as my Guide. I got a problem while using optional parameter. #! user/bin/env python import os def myfiles(directory,extension=None): change that to def myfiles(directory,extension=""): for x in [os.path.join(x,i) f

Re: [Tutor] optional parameter in list comprehension

2008-12-29 Thread bob gailer
Dj Gilcrease wrote: def myfiles(directory,extension=None): for x in [os.path.join(x,i) for x,y,z in os.walk(directory)\ if extension: << SYNTAX ERROR! for i in z if i.endswith(extension)]:print x -- Bob Gailer Chapel Hill NC 919-636-4239 __

Re: [Tutor] optional parameter in list comprehension

2008-12-29 Thread Dj Gilcrease
def myfiles(directory,extension=None): for x in [os.path.join(x,i) for x,y,z in os.walk(directory)\ if extension: for i in z if i.endswith(extension)]:print x Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com ___ Tutor maillist -

[Tutor] optional parameter in list comprehension

2008-12-29 Thread prasad rao
hello!I am a novice looking up to the tutor as my Guide. I got a problem while using optional parameter. #! user/bin/env python import os def myfiles(directory,extension=None): for x in [os.path.join(x,i) for x,y,z in os.walk(directory)\ for i in z if i.endswith(extension)]:prin