惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
D
Docker
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
D
DataBreaches.Net
月光博客
月光博客
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学

噜啦 - 函数

函数变量的作用域 - 噜啦 函数的可变长参数 - 噜啦 函数的可变长参数 - 噜啦 函数的定义和常用操作 && 课堂练习 - 噜啦 函数的定义和常用操作 && 课堂练习 - 噜啦
函数变量的作用域 - 噜啦
博主: 噜啦 · 2019-09-18 · via 噜啦 - 函数

代码

var = 123
def func():
    var = 456
    print(var)

func()
print(var)

运行

定义全局变量

代码

var1 = 123
def func():
    global var1
    var1 = 456
    print(var1)

func()
print(var1)

运行

赞赏作者

如果觉得我的文章对你有用,请随意赞赏