system exec ?
Alex Martelli
aleaxit at yahoo.com
Thu Jul 5 06:27:59 EDT 2001
More information about the Python-list mailing list
Thu Jul 5 06:27:59 EDT 2001
- Previous message (by thread): system exec ?
- Next message (by thread): system exec ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"alphaZeta" <NOSPAM.hnguyen421 at NOSPAM.hotmail.com> wrote in message news:9i1er4$mth$1 at news.businessobjects.com... > Hi, > > I didn't find any documentation (lib and tut) about how to execute a program > in a python script. os.system('theprogram') just executes it. What you desire is different: > Does anybody know ? > > For example : I would like to store in a variable the result of a call to > the system. > alike : >>> a = sys.exe("ls -l") a = os.popen("ls -l").read() may be what you want (but you may also prefer to call .readlines() instead for example, getting the result as a list of strings, one per line, rather than as one big string). Alex
- Previous message (by thread): system exec ?
- Next message (by thread): system exec ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list