python 部分字元 總結
阿新 • • 發佈:2018-11-22
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 pass16 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)