——————
# -*-coding:utf-8 -*-
name = "你好,世界"
print(name)
———————
编码:
ASCII 255储存 1bytes
-->1980 GB2312 7000+储存
-->1995 GBK1.0 20000+储存
-->2000 GB18030 27000+储存
-->unicode 2bytes 16位
-->utf-8 en:1byte, zh:3bytes
————————
注释:
#单行注释
'''
多行
注释
'''
"""
打印
多行
注释
"""
————————
#continue
for i in range(10):
if i < 3
print("loop",i)
else:
continue
print("hehe...")
—————————
#while
age_of_oldboy = '56'
count = 0
while count < 3:
guess_age = input("guess age:")
if guess_age == age_of_oldboy
print("Yes,you got it")
break
elif guess_age < age_of_oldboy
print("Think bigger...")
else :
print("Think smaller..")
count = count + 1
else:
print("You have tried too many times...fuck off")
————————
#for
for i in range(0,10,2):
print("loop",i)
————————
#输入
import getpass
_username = "linyu"
_password = "linyu"
username = input("username:")
password = input("password:")
#password = getpass.getpass("password:")加密
if _username = username and _password = password
print("Welcome user {name} login...".format(name = username))
else:
print("Invalid username or password")
——————————