How can I import an arbitrary python source file (whose filename could contain any characters, and does not always ends with
>>> import imp
>>> path = '/tmp/a-b.txt'
>>> with open(path, 'U') as f:
... mod = imp.load_module('a_b', f, path, ('.py', 'U', imp.PY_SOURCE))
<module 'a_b' from '/tmp/a-b.txt'>
Deprecated since version 3.3: Unneeded as loaders should be used to
load modules and find_module() is deprecated.
Note New programs should use importlib rather than this module.