摘要: 1、字典的声明 dic = {'dog':'wang','cat':'miao','count':3} 2、字典删除 删除某个键值对 dic = {'dog':'wang','cat':'miao','count':3} list1 = [1,2,3] dic.pop('count') #与列表不同 阅读全文
posted @ 2019-10-29 16:31 红枣枸杞 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1、[(x,y) for x in [1,2,3] for y in [4,2,3] if x == y] (x,y):输出表达式,产生最终列表的元素 for x in [1,2,3] for y in [4,2,3]:输入列表 if x == y:可选的判断表达式 2、举个例子,矩阵转置 阅读全文
posted @ 2019-10-29 11:54 红枣枸杞 阅读(145) 评论(0) 推荐(0) 编辑