PDA

View Full Version : Compile Python (quick question)


cobbweb
February 17th, 2006, 06:54 PM
Im I have been programming in Java for a couple of years and have finally relized that i was cutting myself short by not learning all the other possible languages i could learn. So, with that said, im starting with Python then c++ etc I was interested in how to complie a "Python" program and execute it in my terminal. Also what is a Python program saved as? .. Thanks a bunch whoever helps

Cobbweb

Leif
February 17th, 2006, 06:55 PM
python is interpreted. call your program with "python myprog.py"

thumper
February 17th, 2006, 06:56 PM
You don't need to compile python - it is an interpreted language.

For example, the simplest script could be:
#!/usr/bin/env python
print "Hello World"

Save this as hello.py and make it executable. Then executed as ./hello.py and you are off and coding python :)

cobbweb
February 17th, 2006, 07:13 PM
Sweet! Dude, I love it all ready. Very simple and easy... would you guys have any ideas for a simple "Starter" Program to get some practice in with python?

thumper
February 17th, 2006, 07:54 PM
You could go through the tutorials on python.org...