[Tutor] help mee
Alexandre Ratti
alex@gabuzomeu.net
Thu, 02 May 2002 12:39:27 +0200
Hello Del,
At 00:49 02/05/2002 -0400, you wrote:
>From: "Del Kollhoff" <Recoome16@chartermi.net>
>Date: Wed, 1 May 2002 18:29:02 -0400
>Subject: [Tutor] help mee
>how do you put a plain text program into python command line?
To run a Python programm, you can:
1) Run it directly in the system command line (eg. DOS box if you run
Windows, shell if you run a Unix-like system). Basically, the command:
python myscript.py
should work, but this is system-specific. For more information, please tell
us which system you run.
2) You can also import a module into the Python command line (I think this
is what you asked).
- Save your script in a text file. Call it myscript.py. In Python, this
file is called a module.
- Start the Python interpreter.
- On the Python command line (>>>), try:
import myscript
Top-level Python code in the programm will run directly. Objects defined in
"myscript" can be accessed individually. Eg. if "myscript" contains a
function called "myFunction", try this to run it:
myscript.myFunction()
Cheers.
Alexandre