12345678910111213141516171819202122232425262728293031323334 |
- import gc
- import logging
- def _init():
- global global_dict
- global_dict = {}
- def get_dict():
- return global_dict
- def update(_dict):
- # 定义一个全局变量
- try:
- global_dict.update(_dict)
- except Exception as e:
- return
- def get(key):
- # 获得一个全局变量
- try:
- value = global_dict.get(key)
- except Exception as e:
- value = None
- return value
- def _del():
- global global_dict
- del global_dict
- gc.collect()
|