运行python程序的几种方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012247418/article/details/82960622

系统:win10

python版本:3.6

-------------------------

在windows系统下运行python程序的几种方法。

1. 准备代码test.py

msg = input("please input: ")

print("output: ", msg)

2. 打开命令行,切换到test.py所在目录。

1)输入:python test.py

2)直接输入:.\test.py

3)直接双击test.py执行

输入input,按下enter后,命令窗口会直接关闭。这是由于python程序执行完后退出所致,将代码添加一行。

msg = input("please input: ")

print("output: ", msg)

input()

执行结果如下:

4)输入python,在python解释器中直接输入python命令。

执行:print("hello")

猜你喜欢

转载自blog.csdn.net/u012247418/article/details/82960622