ConfigParser vs. import config
问题 ConfigParser is the much debated vanilla configuration parser for Python. However you can simply import config where config.py has python code which sets configuration parameters. What are the pros\cons of these two approaches of configuration? When should I choose each? 回答1: The biggest issue I see with import config is that you don't know what will happen when you import it. Yes, you will get a set of symbols that are naturally referenced using a . style interface. But the code in the