What’s the best practice using a settings file in Python? [closed]

You can have a regular Python module, say config.py, like this:

truck = dict(
    color="blue",
    brand = 'ford',
)
city = 'new york'
cabriolet = dict(
    color="black",
    engine = dict(
        cylinders = 8,
        placement="mid",
    ),
    doors = 2,
)

and use it like this:

import config
print(config.truck['color'])  

Leave a Comment