How do you import a module with "." in its filename?
Duncan Booth
duncan at NOSPAMrcp.co.uk
Wed Jul 31 04:37:16 EDT 2002
"Andrew P. Lentvorski" <bsder at mail.allcaps.org> wrote in
news:mailman.1028080249.16165.python-list at python.org:
> So, how do I import a module with "." in its filename?
>
fname = 'c:/test/a.test.py'
f = file(fname, 'r')
a_test = imp.load_module('a_test', f, fname, ('.py', 'r', imp.PY_SOURCE))
f.close()
See the module imp documentation for further details.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list