在哪种情况下需要从模块导入全局变量

  • 项目里多个脚本均更改「某一个全局变量」时
  • 全量变量需要实现可配置时

从模块导入全局变量的方法

from test_prokject import global_variables

def get_global_variables():
    print(global_variables.deco_trigger)
 
# 其中 global_variables 为文件名,global_variables 文件内容为:deco_trigger = None

相关文章:

  • 2021-10-14
  • 2021-11-15
  • 2021-10-14
  • 2021-10-14
  • 2021-10-14
猜你喜欢
  • 2021-05-24
  • 2022-12-23
  • 2021-04-29
  • 2021-11-05
  • 2021-07-07
  • 2021-10-14
相关资源
相似解决方案