Using Python

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Using Python

Post by astromech_kuhns on Sun Oct 03, 2010 1:36 pm
([msg=46963]see Using Python[/msg])

Hello everyone,

this is my first post although i have lurked a bit on the forum.

so i have a question, i am running linux ubuntu 10.10 RC. i have downloaded and installed python. i can use the terminal and type python to access python. and if i click on python under the programming section in the applications tab, it brings up the terminal with python running the same way.

so i was watching a video tutorial on programming in python. the person in the video was running python on a windows computer. he showed how to save your file. i realised, i didnt have anyway to save the application. can anyone help me out a bit on what all i need to properly run python on linux ubuntu? his video's are good,and there teaching me python pretty well, but it will do me no good if i cant make a program and save it.

so anyone know what else needs to be done in order to fully run python? including saving, and i would assume, im not suppose to be running it out of the terminal....

Thanks!

Kotlon K.
astromech_kuhns
New User
New User
 
Posts: 21
Joined: Sun Oct 03, 2010 1:28 pm
Blog: View Blog (0)


Re: Using Python

Post by Defience on Sun Oct 03, 2010 2:12 pm
([msg=46964]see Re: Using Python[/msg])

Once you have Python's IDLE open, click on 'File' at the top left. Then choose 'New Window'. Type your code into the new window. In the new window, click on 'File' at the top left. Choose 'Save as'. Name your file and save it with a .py extension.

Example:
(put this code in a 'New Window'
Code: Select all

print "Hello, World!"



Save as: HelloWorld.py

Next hit 'F5' on your keyboard to run it.

>>> ================================ RESTART ================================
>>>
Hello, World!

Anytime you want to run a program, you can open IDLE, click 'File', choose 'Open'. Find the file you want and click on it. Click 'Open'. Now with the script open, hit F5.

** if you're running Python 3 it would be:

Code: Select all
print("Hello, World!")
User avatar
Defience
Addict
Addict
 
Posts: 1265
Joined: Thu Jun 12, 2008 3:16 pm
Blog: View Blog (0)


Re: Using Python

Post by fabianhjr on Sun Oct 03, 2010 4:27 pm
([msg=46972]see Re: Using Python[/msg])

I believe that you are missing the point. If you wanna code you need at least a text editor(gedit by example) or an IDE(Geany for instance) The python package only includes the interpreter.
EDIT: s/atn/at/
Last edited by fabianhjr on Sun Oct 03, 2010 4:58 pm, edited 1 time in total.
Donate bitcoins to me! [1DhRP3hHgmSLQdRTZyT8VPTmzAj7Z2rsGA]
Dunno what bitcoins are? BitcoinMe
fabianhjr
Poster
Poster
 
Posts: 286
Joined: Tue Sep 21, 2010 7:48 pm
Blog: View Blog (0)


Re: Using Python

Post by the0nlyb0ss on Sun Oct 03, 2010 4:34 pm
([msg=46975]see Re: Using Python[/msg])

Fabian is right, you have to manually install IDLE from the package manager...
"Knowledge is knowing that a tomato is a fruit, but Wisdom is knowing not to put it in a fruit salad."
User avatar
the0nlyb0ss
Experienced User
Experienced User
 
Posts: 54
Joined: Thu Sep 02, 2010 11:24 pm
Location: California
Blog: View Blog (0)


Re: Using Python

Post by Defience on Sun Oct 03, 2010 8:30 pm
([msg=46987]see Re: Using Python[/msg])

astromech_kuhns, if you don't have IDLE installed you can open a terminal and type:
sudo apt-get install idle-python2.6

or if you're using python 3 type:
sudo apt-get install idle3

It should now be in Applications->Programming->Python IDLE

THEN see my above post.
User avatar
Defience
Addict
Addict
 
Posts: 1265
Joined: Thu Jun 12, 2008 3:16 pm
Blog: View Blog (0)


Re: Using Python

Post by astromech_kuhns on Mon Oct 04, 2010 12:38 am
([msg=47006]see Re: Using Python[/msg])

Thanks all of you. i now have it working correctly. i downloaded the IDLE like you said and it is what i was looking for. thanks a bunch!
astromech_kuhns
New User
New User
 
Posts: 21
Joined: Sun Oct 03, 2010 1:28 pm
Blog: View Blog (0)



Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests