Python 交互模式运行Hello world

  1. cmd窗口输入 python,即可进入Python交互模式
  2. python交互模式下输入:print(“hello world”)
  3. 显示结果:hello world

图示
这里写图片描述

具体运行

D:\PythonProject>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>>
>>>
>>> print("hello world")
hello world
>>>
>>>

cmd窗口运行.py文件

  1. D盘新建PythonProject文件夹
  2. 新建一个文件,例如 helloworld.py
  3. helloworld.py 填写 print(“hello world”)
  4. D盘下运行 python helloworld.py
  5. 运行结果:hello world

这里写图片描述

helloworld.py

print("hello world")

这里写图片描述

D:\PythonProject>python helloworld.py
hello world
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐