Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Created February 20, 2014 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuuichi-fujioka/9108421 to your computer and use it in GitHub Desktop.
Save yuuichi-fujioka/9108421 to your computer and use it in GitHub Desktop.
Example of load python based config file
v = {
'foo': 'bar'
}
from __future__ import print_function
import time
def load_conf_and_print():
_globals = {}
_locals = {}
execfile('conf.py', _globals, _locals)
print(_locals['v']['foo'])
def main():
while True:
load_conf_and_print()
time.sleep(1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment