How can I import a script with an arbitrary name ?
Rob Williscroft
rtw at freenet.co.uk
Mon Oct 30 09:12:41 EST 2006
More information about the Python-list mailing list
Mon Oct 30 09:12:41 EST 2006
- Previous message (by thread): How can I import a script with an arbitrary name ?
- Next message (by thread): How can I import a script with an arbitrary name ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
wrote in news:1162217006.567079.315440 at i42g2000cwa.googlegroups.com in comp.lang.python: > Hi all, > > I have a script responsible for loading and executing scripts on a > daily basis. Something like this: > > import time > t = time.gmtime() > filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' > import filename > > So, I have a module with an arbitrary file name and I want to load it, > and later access its function definitions. > How can I do this ? In my example, the last line will obviously not > work. > http://docs.python.org/lib/built-in-funcs.html The first one __import__ should do the trick. Rob. -- http://www.victim-prime.dsl.pipex.com/
- Previous message (by thread): How can I import a script with an arbitrary name ?
- Next message (by thread): How can I import a script with an arbitrary name ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list