Re: Getting a dictionnary from a module's variables

2017-07-28 Thread Gregory Ewing
ast wrote: dir(config) provides a list, some processing is needed to remove some __identifiers__ and get a dict Is there a simple way to do that, without processing ? Here's an alternative that leverages the import machinery. d = {} exec("from config import *", d) del d['__builtin

Re: Getting a dictionnary from a module's variables

2017-07-28 Thread ast
"ast" a écrit dans le message de news:597b31fb$0$4823$426a3...@news.free.fr... I answer to myself import config dico = {k:v for k, v in vars(conf).items() if not (k.startswith('__') or k.endswith('__'))} that's not so difficult -- https://mail.python.org/mailman/listinfo/python-list