combining the path and fileinput modules
Gabriel Genellina
gagsl-py at yahoo.com.ar
Fri Nov 24 21:47:35 EST 2006
At Thursday 23/11/2006 12:21, wo_shi_big_stomach wrote:
> >> dir = path(/home/wsbs/Maildir)
> >> for f in dir.walkfiles('*'):
> >> #
> >> # test:
> >> # print f
> >
> > Are you absolutely sure that f list doesn't contain
> > any path to directory, not file?
> > Add this:
> >
> > f = filter(os.path.isfile, f)
> >
> > and try one more time.
>
>Sorry, no joy. Printing f then produces:
>
>rppp
>rppppp
>rppppp
The filter should be applied to walkfiles. Something like this:
dir = path(/home/wsbs/Maildir)
for f in filter(os.path.isfile, dir.walkfiles('*')):
#
# test:
# print f
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list