所有的程序员都是编剧,所有的计算机都是烂演员。   
返回顶部
摘要: 1、global:在局部修改全局变量 x=100 def foo(): global x x=200 foo() print(x) #todo 如果不写global,则打印为100 2、nonlocal:只在函数内部找变量,如果没有则报错 x=100 def a(): x=200 def b(): 阅读全文
posted @ 2018-04-26 18:22 steven丶syw 阅读(118) 评论(0) 推荐(0) 编辑