摘要: dic ={}s = "k:1|k1:2|k2:3|k3:4"lst = s.split("|")for i in lst: lst1 =i.split(":") #k,v = i.split(":") dic(k) = int(v) dic[lst1[0]] = int(lst1[1])print 阅读全文
posted @ 2019-05-29 14:47 冰灬荷 阅读(492) 评论(0) 推荐(0) 编辑
摘要: count = 1lst = []lst1 = []while count <=10: name = input("请输入您心仪的女生(您还可以输入%s个):" % (11-count)) lst.append(name) count = count +1print("您当前心仪的女生有:")for 阅读全文
posted @ 2019-05-29 10:10 冰灬荷 阅读(192) 评论(0) 推荐(0) 编辑
摘要: number = int(input("请输入一个数字:"))lst = []for i in range(number+1): if i == 7: lst.append("咣") else: lst.append(i)print(lst) 阅读全文
posted @ 2019-05-29 09:05 冰灬荷 阅读(272) 评论(0) 推荐(0) 编辑
摘要: lis = []sum = 0while True: content = input("请输入成绩(格式如下张三_44),输入Q退出:") if content == "Q": break else: lis .append(content)for i in lis: s = i.split("_" 阅读全文
posted @ 2019-05-29 08:10 冰灬荷 阅读(218) 评论(0) 推荐(0) 编辑
摘要: li = ["alex","WuSir","ritian","barry","wenzhou"]s = "_".join(li)print(s)结果: alex_WuSir_ritian_barry_wenzhou 阅读全文
posted @ 2019-05-28 13:50 冰灬荷 阅读(71) 评论(0) 推荐(0) 编辑
摘要: li = ["苍老师" ,"东京热" ,"武藤兰" ,"波多野结衣"]lis = []content = input("请输入评论内容")for i in li: if i in content: content = content.replace(i,"*" * len(i)) #要从新赋值lis 阅读全文
posted @ 2019-05-28 13:46 冰灬荷 阅读(146) 评论(0) 推荐(0) 编辑
摘要: li = ["TaiBai", "ale xC", "AbC ", "egon", "ri TiAn", "WuSir", " aqc"]lis = []for i in range(len(li)): li[i] = li[i].replace(" ","") if li[i][0] == "A" 阅读全文
posted @ 2019-05-28 13:31 冰灬荷 阅读(266) 评论(0) 推荐(0) 编辑
摘要: lis = []for i in range(31): lis.append(i)print(lis)for j in lis: if j %3 ==0: lis[j] = "*"print(lis) 阅读全文
posted @ 2019-05-28 13:27 冰灬荷 阅读(498) 评论(0) 推荐(0) 编辑
摘要: name = input("请输入姓名:")address = input("请输入地点:")honey = input("请输入爱好:")print("敬爱可亲的 %s,最喜欢在 %s地方干%s" %(name,address,honey)) 阅读全文
posted @ 2019-05-28 06:43 冰灬荷 阅读(83) 评论(0) 推荐(0) 编辑
摘要: content = input("请输入内容")if content == content[::-1]: print("这是一个回文句")else: print("这不是一个回文句") 阅读全文
posted @ 2019-05-28 06:40 冰灬荷 阅读(163) 评论(0) 推荐(0) 编辑