newbie question - executing system commands
Alex Martelli
aleax at aleax.it
Tue Sep 4 10:21:35 EDT 2001
More information about the Python-list mailing list
Tue Sep 4 10:21:35 EDT 2001
- Previous message (by thread): newbie question - executing system commands
- Next message (by thread): newbie question - executing system commands
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Borzoj" <borzoj at pingu.ii.uj.edu.pl> wrote in message news:9n23h1$qsc$1 at news.formus.pl... > I'm newbie both in shell scripting and pyhon so please be kind :) > What would be the Python equivalent for following shell code: > > for IMAGE_NAME in `ls`; do { > #processing of $IMAGE_NAME > };done > > > ...or in other words what is the easiest way to execute shell > command/external program from python and > get access to it's output? For this specific example, you want os.popen: import os for image_name in os.popen('ls').readlines(): process(image_name) Alex
- Previous message (by thread): newbie question - executing system commands
- Next message (by thread): newbie question - executing system commands
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list