摘要: 字符串的内置用法: 1 st='hello kitty {name} age is {age}' 2 print(st.count('l')) #统计元素个数 3 print(st.capitalize()) #首字母大写 4 print(st.center(50,'-')) #居中 5 print 阅读全文
posted @ 2019-04-07 00:53 再也不会见 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 还有一些其他用法 元组的创建 1 menu={ 2 '北京':{ 3 '朝阳':{ 4 '国贸':{ 5 'CICC':{}, 6 'HP':{}, 7 '渣打银行':{}, 8 'CCTV':{}, 9 }, 10 '望京':{ 11 '陌陌':{}, 12 '奔驰':{}, 13 '360':{ 阅读全文
posted @ 2019-04-07 00:49 再也不会见 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 1 while True: 2 salary = input("please input your salary:") 3 if salary.isdigit(): 4 salary=int (salary) 5 break 6 else: 7 print("Invalid input! pleas 阅读全文
posted @ 2019-04-07 00:30 再也不会见 阅读(570) 评论(0) 推荐(0) 编辑
摘要: 1 _user="cindy" 2 _pwd="password" 3 passed_authentication = False 4 for i in range (3): 5 username = input("Username=") 6 password = input("Password=" 阅读全文
posted @ 2019-04-07 00:21 再也不会见 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1 line =9 2 while line >0: 3 #print ("*") 4 tmp =line 5 while tmp >0: 6 print ("#",end="") 7 tmp-=1 8 line -=1 9 print() 10 11 first =0 12 while first 阅读全文
posted @ 2019-04-07 00:14 再也不会见 阅读(172) 评论(0) 推荐(0) 编辑