# Linux系统中声明解释器 python2 和 python3 解释器位置 # #!/usr/bin/env python # Linux系统中通过./执行 # python2 默认使用ascill码,声明编码,python3 不需要 Unicode # #-*- coding:utf8 -*- #print('hello world') name = input('请输入用户名:')# 等待 直到用户输入值 if name: code = input('请输入密码:') if code: code_check = input('请确定密码:') if code == code_check: print('创建用户成功\n') usr = name usr_code = code id = 1 # if 条件 else/else if 条件 # 空语句 pass eg: if 0 pass else print("wrong") # "str" 'str' """str""" '''str''' 字符串的表示方法 # python中字符串可以直接相加 字符串*数字 重复n遍 # ** 表示 ^ 乘方 // 真商(舍弃余数) #import time # time 时间 while id: print("now usr: ", usr, "\nusr code: ", usr_code) id = 0 # while 条件 else else语句执行一次 # continue 结束本次循环 break 终止循环 # sum(1, 2, 3, 4) # in/not in 子集 可用于条件判断 # ctrl + ? 区域注释 # <>/!= 不等于 not 取非 and 且 or 或