Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'global_var' is not defined #34

Open
heiGT001 opened this issue May 21, 2024 · 2 comments
Open

NameError: name 'global_var' is not defined #34

heiGT001 opened this issue May 21, 2024 · 2 comments

Comments

@heiGT001
Copy link

NameError: name 'global_var' is not defined
Did the author upload this file?

@qiherong
Copy link

I have the same problem. Have you solved it

@bhsud
Copy link

bhsud commented Jun 6, 2024

I found it! create global_var.py and past following.

def _init(): # 初始化
global _global_dict
_global_dict = {}

def set_value(key, value):
# 定义一个全局变量
_global_dict[key] = value

def get_value(key):
# 获得一个全局变量,不存在则提示读取对应变量失败
try:
return _global_dict[key]
except:
print('读取'+key+'失败\r\n')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants