摘要: 文件的读取、写入 参考资料:https://www.cnblogs.com/zyber/p/9578240.html https://www.runoob.com/python3/python3-file-methods.html 1、open函数 a、open('test.txt', mode=' 阅读全文
posted @ 2021-07-28 12:04 空-山-新-雨 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 参考资料:https://www.jianshu.com/p/68f5ef6c3cee LEGB法则 Python的变量名解析机制称为 LEGB 法则,这也是由作用域的命名而来的。 当在函数中使用变量时,Python搜索4个 作用域:本地作用域(L)、之后是上一层结构中的 def 或 lambda 阅读全文
posted @ 2021-07-28 11:45 空-山-新-雨 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 函数调用时,拆包 1、 * 对 元组 / 列表 拆包 2、** 对字典拆包 , 2个** 对应 key 、value 示例代码如下: def func_0(a, b, c): print(a, b, c) t = (1, 2, 4) func_0(*t) # 对元组拆包 # 练习题一: # 将输入的 阅读全文
posted @ 2021-07-28 09:27 空-山-新-雨 阅读(63) 评论(0) 推荐(0) 编辑