首页 > 其他 > 详细

File "<stdin>" , line 1

时间:2017-05-03 09:16:27      阅读:446      评论:0      收藏:0      [点我收藏+]

写了一个hello.py,仅有一句,print ‘hello world‘,

运行 Python hello.py 出错,提示:

File "<stdin>" , line 1
python hello.py

 

解释:

In the shell you can run shell commands, in the Python command line you can run Python code.

"python hello.py" is a shell command, not Python code, so you should run it in the shell, but not on the Python command line. 

"print "hello"" is Python code, so you can run it on the Python command line, but not in the shell.

 

故,退出python命令行,直接cd到hello.py所在目录,运行python hello.py,成功。

 

 

 

技术分享

 

File "<stdin>" , line 1

原文:http://www.cnblogs.com/huchaoheng/p/6800150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!