【发布时间】:2016-04-15 12:56:50
【问题描述】:
我有一个file1.py:
def battery():
pass
// much more methods here
if __name__ == "__main__":
cmd = str((sys.argv)[1]) + "()"
os.system(cmd)
现在我想用python file1.py battery 从Linux 控制台调用file1.battery()。
但我得到了错误:
sh: 1: Syntax error: end of file unexpected
【问题讨论】:
标签: python linux function console arguments