1.实现用户账号密码校验登录(已实现)
count=0
right_accond='admin'
right_password='666;8'
whlie count<3:
user=input('input your accond')
password=input('input your password')
if user==right_accond and password==right_password:
print('you are loge in.')
break
else:
print('worng accond')
count=count+1
else:
print('you are out off choice.')
2.pycharm安装(需要注册,安装失败,继续用python)
create new-pythone 35
3.运算符 and、or没有优先级
4.数据类型的方法:
int:
type(变量)
int(变量,base=2)
#强制类型转换,转换为2进制
num='b'
v=int(num,base=16)
#转换为16进制输出
print(v)
age=23
#表示数据2进制长度
r=age.bit_length()
print(r)
string:
test='alexddbcex'
#首字母大写
v=test.capitalize()
#大写变小写,casefold()可以变化未知道的对应关系
test.casefold()
test.lower()
#放中间(20个长度,空白位置填充一个字符)
test.center(20,‘*’)
#计算r的个数,开始位置,结束位置
test.count('r',5,8)
#判断是否以a结尾
test.endwith('a')
#判断是否以a开头
test.startwith('a')
#从开始往后找,找到第一个,返回位置。从5开始,7结束。开区间
test.find('ex',5,7)
#替换指定值
test='I am {name}'
test.format(name='alex')
#按顺序替换指定值
test='I am {0},age {1}'
test.format('alex',23)
#按顺序替换指定值
test='I am {name},age {age}'
test.format_map(name:'alex',age:23)
#找索引,找不到报错
test.index('a')