摘要:
dict = { "河北": { "石家庄":{"晋州市","平山县","元氏"}, "邯郸": {"永年","涉县","磁县"}, }, "河南": { "郑州": {"新郑","荥阳","新密"}, "周口": {"项城","淮阳","太康&qu 阅读全文
摘要:
1.字典 li = {"alex"," aric","Alex","Tony","rain"}for i,j in enumerate(li,1): new_j = j.strip() print(i,new_j) RESTART: C:/Users/wssar/AppData/Local/Prog 阅读全文
摘要:
li = ["alex"," aric","Alex","Tony","rain"]for i in li: new_li = i.strip() if (new_li.startswith('a') or new_li.startswith('A')) and new_li.endswith('c 阅读全文
摘要:
li = [11,22,33,44,55,66,77,88,99]dict = {'k1':[],'k2':[]}for i in li: if i < 66: dict["k1"].append(i) else: dict['k2'].append(i)print(dict) 阅读全文
摘要:
s1 = "李露"l1 = list(s1)print(l1) s2 = ("alex","laonanhai","seven")l2 = list(s2)print(l2) s3 = {"k1":"alex", "k2":"seven"}l3 = list(s3.items())print(l3) 阅读全文
摘要:
x = str() #创建字符串#转换成字符串,字节,编码 m = bytes()#创建字节#转换成字节,字符串,要编程什么编码类型的字节 a = "李露" b1 = bytes(a, encoding='utf-8')print(b1)b2 = bytes(a, encoding='gbk')pr 阅读全文
摘要:
# enumerate 自动生成一列, 默认0开始,每次自增+1li = ["电脑","鼠标垫","U盘","游艇"]for key, item in enumerate(li, 1): print(key,item) inp = input("请输入商品:")# 字符串转换成intinp_num 阅读全文
摘要:
name = 0while name < 3: user = input("请输入用户名:") psd = input("请输入密码:") if user == "wss" and psd == "123": print("登陆成功") break else: print("请重新输入") name 阅读全文