python 部分字符 总结
Posted chentianjia2019
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 部分字符 总结相关的知识,希望对你有一定的参考价值。
1 n = 0 2 while n < 3: 3 name = input("请输入姓名:") 4 pwd = input("请输入密码:") 5 if name == "chentianjia" and pwd =="chen123..": 6 print("欢迎光临") 7 break 8 else: 9 print("账号密码错误") 10 n = n+1 11 n = 1 12 while n<100: 13 a = n%2 14 if a==0: 15 pass 16 else: 17 print(n) 18 n = n+1 19 20 name = "chentianjia" 21 test = name.center(20,"a") 22 print(test) 23 24 name = "zhangjiaming" 25 test = name.capitalize() 26 print(test) 27 28 name = "zhangjianming" 29 test = name.count("a",2,9) 30 print(test) 31 32 name = "CHENTIANJIA" 33 test = name.casefold() 34 print(test) 35 36 name = "ZHANGJIAMING" 37 test = name.lower() 38 print(test) 39 40 number = "500" 41 test = int(number) 42 print(type(test),test) 43 44 number = 500 45 print(type(number),number) 46 47 number = 500 48 test = number 49 print(type(number),number) 50 51 number = "500" 52 print(type(number),number)
以上是关于python 部分字符 总结的主要内容,如果未能解决你的问题,请参考以下文章