新人求解

Staycam 2018-01-29 11:57:04
from sys import argv

script, first, second, third = argv

print("The script is called:",script)
print("Your first variable is:", first)
print("Your second variable is:",second)
print("You third variable is:", third)

感觉这段话每月错啊,为啥运行提示错误呢??

>>> python ex_13.py 1 2 3
File "<stdin>", line 1
python ex_13.py 1 2 3
^
SyntaxError: invalid syntax
...全文
375 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
陈年椰子 2018-01-30
  • 打赏
  • 举报
回复
看起来是找不到 ex_13.py 这个文件。 要在存放 ex_13.py 的目录下运行。 或者给 ex_13.py 指定目录。 比如 python d:\dev\ex_13.py 1 2 3
虾米馅煎包 2018-01-30
  • 打赏
  • 举报
回复
语法错误 正确运行方式应该是 Python demo.py 1,2,3

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧