电脑系统:win10
python版本:3.7.0
1、修改盘符,比如跳转到D盘:
d:
2、创建.py文件:
type nul>hello.py
3、hello world程序:
print('hello world!')
4、程序运行:
python hello.py
5、在mac和linux上直接运行 .py文件(windows下不支持):
(1)在.py文件开始加上注释:
#!/usr/bin/env python3
(2)给文件执行权限:
chmod a+x hello.py
(3)运行:
./hello.py
6、输出:print函数的使用:
(1)依次打印每个字符串:
print('i', 'am', 'a', 'boy')
(2)打印整数:
print('100 + 200 = ', 100 + 200)
7、输入:input函数的使用:
(1)不带提示输入:
name = input()
print('hello', name)
(2)带提示输入:
name = input('please enter your name: ')
print('hello', name)