Python程序:
1.
终端:
D:\Program Files\Python\Python36\python.exe D:\Python\class1.py
解释器:
D:\Program Files\Python\Python36\python.exe
2. 文件形式
#/usr/bin/u/ubv/a python
python 1.py
./1.py 添加执行权限
3. python编码格式
#/usr/bin/u/ubv/a python
# -*- coding:utf-8 -*-
补充:
字节,位
unicode utf8 gbk
utf8: 3
gbk : 2
4. python打印字符串
print("sdaadff")
5. python输入
inp = input('>>>')PS:>>> helloinp = "hello">>> 10inp = "10"# 如果将字符串转换成数字 new_inp = int(inp)inp * 10 =?????
6. 变量名
变量名只能包含“字母、数字、下划线”
要求:
不能数字开头
不能使用关键字
建议不要用python内置的。。。。
7. 条件语句
1. 基本
2. 嵌套
3. if elif else ...
8. while循环
while 条件:....print('...')补充:a. while elseb. continue breakcontinue : 终止当前循环,开始下一次循环break : 终止所有循环
用户登陆(三次机会重试)
count = 0while count < 3:user = input('>>>')pwd = input('>>>')if user == 'ocean' and pwd == 'password123':print('welcome login')print('crazy tank')breakelse:print('用户名或者密码错误')count = count + 1