> a = os.system('ls *JPG | wc -l')
> when i do:
> print a
> i get '0'.

os.system only returns the exitcode of the command not the output.

Look at the new Subprocess  module and its Popen class. It can 
look intimidating at first but read the examples and you should find 
it easy enough.

Altrernatively try the commands module although subprocess is 
intended to replace it...

However you might find it easier to use the python os tools like listdir 
to do the job directly. 

a = len(os.listdir(mydir, '*JPG')

Should be about right...

HTH,

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to