Can I import an arbitary file?
Peter Ballard
pballard at ozemail.com.au
Mon Feb 25 21:11:09 EST 2002
G'day all,
I've written a program (an SRAM generator, if you must know) which
has some configuration info (for different SRAM sizes etc.) in a separate
file. This configuration file is python code.
What I want to do is import this file. The problem is, this file could
be any name at all. What I want to do is parse my command line, and
find out the name of my configuration file, and then import the file of
that name. Is that possible?
(Obviously I can read in this arbitrary file and parse it,
but to actually execute it would be much neater).
Or is there any other way I can read in a file of an arbitary name,
and execute its code?
Thanks in advance,
Peter Ballard
(From Australia, the speed skating capital of the world :-)
More information about the Python-list
mailing list