python sample.py arg2 arg3

arg1 是文件名自身 本例为"sample.py"

import sys

print(type(sys.argv))  # <type 'list'>
print(len(sys.argv))   # 3
print(sys.argv[0])     # 'sample.py'

zxyle
47 声望0 粉丝