$ python hello.py运行失败
我是python的初学者,在学习脚本编程的时候,报了如下错误
科普知识时刻
交互式编程:直接在命令行写代码
脚本式编程:把代码写在一个.py后缀名的文件里面
然后在命令行调用文件名 $ python hello.py
错误原因
$ python hello.py
$是unix或者linux里面的专用符号,$
的意思就是“提示用户输入命令行”
正确的做法
先通过dos命令进入hello.py的文件位置,然后输入python hello.py