摘要: 1.python局部作用域引用错误。因为 test 函数中的 num使用的是局部,未定义,所以无法进行修改 num = 10 #全局定义 def test(): num = num+ 1 #局部未定义 print(anum) test() 2.改为 num = 10 #全局定义 def test() 阅读全文
posted @ 2021-02-25 11:14 倔强的烤马铃薯 阅读(40) 评论(0) 推荐(0)