[Tutor] how to extract number of files from directory
Eric Walker
ewalker at micron.com
Wed Oct 12 20:48:49 CEST 2005
I think os.system returns status of commands
Try this:
w = os.popen('ls -l | wc -l').readlines()
Python Newbie...
On Wednesday 12 October 2005 12:10 pm, Marc Buehler wrote:
> hi.
>
> i'm new to Python ...
>
> i would like to extract the number of JPG files
> from the current directory and use that number
> as a parameter in my python script.
> i tried:
> a = os.system('ls *JPG | wc -l')
> when i do:
> print a
> i get '0'.
>
> what am i missing?
>
> marc
>
> ---------------------------------------------------------------------------
>------------ The apocalyptic vision of a criminally insane charismatic cult
> leader
>
> http://www.marcbuehler.net
> ---------------------------------------------------------------------------
>-------------
>
>
>
> __________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs. Try it free.
> http://music.yahoo.com/unlimited/
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list