defining functions
kyosohma at gmail.com
kyosohma at gmail.com
Thu Apr 5 14:42:51 EDT 2007
On Apr 5, 1:38 pm, "Andre P.S Duarte" <andre.ditador9... at gmail.com>
wrote:
> How do I define a function, then import it, without having to save it
> in lib; like "C:\python25\lib". ?
Defining a function:
def someFunc():
# do something here
Save the file some place. Import the sys module BEFORE you import your
module. Then enter the following code:
sys.path.append(r'path\to\yourFile.py')
Now import your python module. This will temporarily add that path to
the python path (or is it system path?) for the amount of time it
takes to execute your script.
Mike
More information about the Python-list
mailing list