os.popen() and dir command

Gilles Lenfant glenfant at NOSPAM.bigfoot.com
Tue Feb 4 10:04:11 EST 2003


"nobody" <nobody at nowhere.near.here> a écrit dans le message de news:
b1oj7g$j5q$1 at news7.svr.pol.co.uk...
> The following code does not run properly on Windows XP
> (it is supposed to get all zip file names):
>
> f =os.popen("dir /b /s w:\\*.zip")
> p=f.readlines()
>
> The p will end up with a lot of nulls in it, it looks that os.popen() is
> still broken.
> Does anybody else have problem with os.popen() and dir command?
>
>

Check the "glob" package in the standard Python distro for any platform.
Whith this package, you don't need any "popen" to get a list of files that
match a pattern.

--Gilles







More information about the Python-list mailing list