摘要: 字典 dict 主要方法: keys() ,values(),items() ,get() ,update() 基本结构: info = { "k1":18, "k2":19 } # 字典的value可以是任意值;布尔值、列表、字典不能作为字典的key #字典无序 info = { "k1":18, 阅读全文
posted @ 2020-03-12 22:21 zhuanfang 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 元组 tuple 相当于是列表的加工 列表相同点: 1、可索引、切片 2、能用for循环,可迭代对象 3、元素是有序的 列表不同点: 1、格式() 2、元组的一级元素不可被修改(增加、删除) # 字符串、列表、元素 3者可互相转换 test1 = "hello word" test2 = [123, 阅读全文
posted @ 2020-03-12 22:19 zhuanfang 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 字符串-str ***7个基本魔法**** join v = "连接符".join(test)split v = test.split("分隔符",1)find v = test.find("C",3,9) #找到C,在区间3-9strip v = test.strip()upper v = tes 阅读全文
posted @ 2020-03-12 16:15 zhuanfang 阅读(203) 评论(0) 推荐(0) 编辑