格式化输出
#示例1:
website=input("please input your website: ")
user=input("please input your username: ")
password=input("please input your password: ")
output="website:%s user:%s password:%s" %(website,user,password)
print(output)
'''
please input your website: lxzy.ml
please input your username: admin
please input your password: 123456
website:lxzy.ml user:admin password:123456
'''
#示例2:
name = input('请输入姓名:')
age = input('请输入年龄:')
job = input('请输入工作:')
msg = '''------------ info of %s -----------
Name : %s
Age : %d
job : %s
------------- end -----------------''' %(name,name,int(age),job)
print(msg)
#这里用注释符定义字符串可以保留原格式输出(含换行)
#另外注意如果在有格式化输出的字符串中使用%正常表示百分比时需要写为%%。
while-else
while 后面的else 作用是指,当while 循环正常执行完,中间没有被break 中止的话,就会执行else后面的语句。
运算符
| 运算符 | 描述 | 实例 |
| / | 与c++不同,表示正常的除法 | print(5/2) #2.5 |
| ** | 幂运算 | print(2**6) #64 |
| // | 取整除,返回商的整数部分 | print(5/2) #2 |
| <> | 判断中的不等于,作用等同于!= | |
| += | 类似的还有-=,*=,/=,%=,**=,//= | c+=1等价于c=c+1 |
| and | “与” | |
| or | “或” | |
| not | “非” | |
| in | 在指定序列中找到值返回True,反之返回False | print(‘a’ in ‘bcvd’) #False |
| not in | 在指定序列中未找到值返回True,反之返回False | print(‘a’ not in ‘bcvd’) #True |
关于逻辑运算的优先级:
1、优先级:()>not>and>or,同优先级从左向右算

print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6)
# False and False or False and True and True or False
# False or False or False
# False
print(0 or 4 and 3 or 7 or 9 and 6)
# 0 or 3 or 7 or 6
# 3 or 7 or 6
# 3
关于编码
ascii 涵盖了英文字母大小写,特殊字符,数字。共八位,一个字节,第一位是0作为预留位。
万国码 unicode 16位两个字节,升级为32位四个字节。
Unicode 升级 utf-8 utf-16 utf-32 其中utf-8用一个字节表示英文,两个字节表示欧洲文字,三个字节表示中文。
gbk 中国人自己发明的,一个中文用两个字节 16位去表示,英文一个字节。
