Home Python入门:import后调用文件变量
Post
Cancel

Python入门:import后调用文件变量

如何import 某个文件之后,调用它的变量?

# settings.py
cache_on = 0

# test_settings.py
import settings
print settings.cache_on  # => 0 
This post is licensed under CC BY 4.0 by the author.