[Tutor] Invoking Python
kinuthiA muchanE
muchanek at gmail.com
Thu Jun 26 07:46:51 CEST 2008
On Tue, 2008-06-24 at 11:11 -0700, Danny Laya wrote:
> ... or you could start you fire up a text editor (something like
> Notepad
> in Windows, or nano in Linux and type "3+4"(without the quotes!),
> hmmm..., and save the file as anything you want, lets say for now you
> save the file as "threePlusFour". Every time you invoke the python
> interpreter (do you know how to do that?) with "threePlusFour", you
> will
> get the value seven!
>
> Well HE..HE i don't know. Let say I write the "threePlusFour" file in
> /home/danny/threePlusFour.py
> How I can invoke that file
> ???
>From the forward slashes in the file path I assume you are using a Linux based OS, Ubuntu perhaps? Well, to use python
you need to to start the terminal or the shell. In Ubuntu, go to Main
Menu ==> Accessories and click on Terminal, you will now have a new
window open with something like this --- kinuthia at tchane:~$ .
Enter the name "python" followed by the name of your file. In this case
you should enter "python /home/danny/threePlusFour.py"(without the
quotes!). If you want to enter into the Python interactive prompt,
simply type python and you should be rewarded with something like:
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
The ">>>" there means python is waiting for you to enter commands.
Try 3+4, or 4/3
Does this help?
Kinuthia...
More information about the Tutor
mailing list