python day03

float('66.6') 转为浮点数  int()  str()

 

pep8规范

成员运算符 :in / not in

逻辑运算符:and or 

count()统计次数,   

字符串名.count()

字符串名.isdigit() #统计字符串是不是全都为数字

字符串名.isalpha()#统计字符串是不是全都为字母

1 str2 = 'dddfgkdd'
2 print(str2.count('d')) #统计字符串出现的次数
3 print(str2.isalpha()) #统计字符串是不是全都为字母
4 print(str2.isdigit())  #统计字符串是不是全都为字母
5 print(str2.endswith('d')) #判断尾
6 print(str2.startswith('d')) #判断首

 

posted @ 2019-08-28 12:02  晓亮86  阅读(149)  评论(0)    收藏  举报