会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
所有的程序员都是编剧,所有的计算机都是烂演员。   
返回顶部
steven丶syw
Quiet as the sky, soaring like an eagle. 长春工业大学在校大三学生.
博客园
首页
新随笔
联系
订阅
管理
2018年4月26日
python——函数 14、global与nonlocal
摘要: 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)
编辑
公告