1
2
3
|
>>>
os.system( 'ls' ) anaconda - ks.cfg
install.log install.log.syslog send_sms_service.py sms.py 0 |
1
2
3
4
5
|
>>> import os >>> str = os.popen( "ls" ).read() >>>
a = str .split( "\n" ) >>> for b in a: print b |
1
2
3
4
5
6
7
8
9
10
11
12
|
import commands a,b = commands.getstatusoutput( 'ls' ) a是退出状态 b是输出的结果。 >>> import commands >>>
a,b = commands.getstatusoutput( 'ls' ) >>> print a 0 >>> print b anaconda - ks.cfg install.log install.log.syslog |