摘要: 菜鸟教程:https://www.runoob.com/python3/python3-data-structure.html 链接 1 # 在字典中遍历时,关键字和对应的值可以使用 items() 方法同时解读出来: 2 knights = {'gallahad': 'the pure', 'ro 阅读全文
posted @ 2023-09-03 09:21 limalove 阅读(13) 评论(0) 推荐(0)
摘要: 1 #嵌套列表解析,讲3*4的矩阵转换成4*3的矩阵 2 3 matrix = [[1, 2, 3, 4], 4 [5, 6, 7, 8], 5 [9, 10, 11, 12]] 6 7 8 for row in matrix: 9 print("遍历每一行:",row) 10 11 12 prin 阅读全文
posted @ 2023-09-03 09:10 limalove 阅读(110) 评论(0) 推荐(0)
摘要: Ctrl + / 快捷键:对选中的代码添加/取消注释,可一次性操作多行。 Tab / Shift + Tab:缩进和取消缩进; Ctrl + Alt + L快捷键:格式化选中的代码; 阅读全文
posted @ 2023-09-03 01:20 limalove 阅读(41) 评论(0) 推荐(0)
摘要: Python文件有两种使用方法: 1,直接作为独立代码(模块 )执行; 2,被Python其他文件引用; ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ 在装饰器一章提到 , 当作脚本运行时才执行 if __name__ == "__main__" 代码块的内容。 如果是导入模块,说明不作为脚本运行,则不执行 阅读全文
posted @ 2023-09-03 01:03 limalove 阅读(392) 评论(0) 推荐(0)