摘要: #1打开文件方式以分割形式读取前五行 1 f=open("singer","r") 2 datatemp=data.splitlines() 3 print(datatemp) 4 print(datatemp[0:5]) 5 for i in data.splitlines()[0:5]: 6 p 阅读全文
posted @ 2018-02-28 18:38 JIMfan 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 name="my name is good asbxs" 2 print(name.capitalize())# 首字母大写 3 print("My NAME IS GOOD".casefold())#变小写 4 print(name.center(20,"_"))#以"_"头尾相加补全字符串长度 5 print (name.count("o",1,2))#查找字符串在整个字符串中... 阅读全文
posted @ 2018-02-28 16:17 JIMfan 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 1 Shopping_Cart=[] 2 3 commodity=[("iphone",5000), 4 ("bike",200), 5 ("book",100), 6 ("computer",3000), 7 ("car",10000), 8 ] 9 salary=input("please input your salary:") 10 11 # print(commo... 阅读全文
posted @ 2018-02-28 05:00 JIMfan 阅读(128) 评论(0) 推荐(0) 编辑