摘要:
#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 阅读全文
摘要:
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))#查找字符串在整个字符串中... 阅读全文
摘要:
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... 阅读全文