system返回值为0表示成功,否则表示失败
import os
print os.system("ls")
>> print os.system("ls")
aaaa.tar mysql.txt untitled.py
0
----------------------------------------
sys.exit()终止进程
import sys
try:
filename = sys.argv[1]
print filename
except:
print "Udage:",sys.argv[0],"filename"
sys.exit(1)
阅读(882) | 评论(0) | 转发(0) |