Jump to content
  • Advertisement
Sign in to follow this  
Samantha aka Lilly

Python.......I don't know what to do........

This topic is 4830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
First, assuming you're running on Windows, you should have, in your start menu, a link to IDLE, which is the standard python editor. When you fire it up, an interpreter window should open in which you can type code that will immediately be executed.

e.g., if you type 2+2, the interpreter will reply (unsurprinsingly) 4.

if you type:

for x in range(10):
print x

it will print numbers from 0 to 9.

The interpreter is very handy to test code as you write it, but you will want to put your programs in actual files. To do that, chose the New Window option under File, and start typing in there.

For example:


for x in range(50):
print "Hello World!"



Save it as "hello.py" somewhere where you'll find the file easily (e.g. on your desktop). You can then, if you wish, execute it by pressing F5. The output will go into the interpreter window. Alternatively, you can execute the script by double-clicking (this will open a console which will close after program termination, as is the case with all console applications).

Finally, you can open a console window (cmd.exe) and, in the appropriate directory, type python hello.py, for similar results (assuming python.exe is on your path). Note that it is possible, in windows, to register .py files as being directly executable from the command-line, but I don't remember the exact process.



Where you go from here is up to you. If you were faced with a C++ IDE, what would you do? Python is no different. Only more convenient.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
www.google.com

Try Pythons actual page, has a lot of information on it. Also do a search in your best friend EVER, google, for 'python tutorials'.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Editor that I like to use: http://www.stani.be/python/spe/blog

Works well for what I want.

Share this post


Link to post
Share on other sites
Quote:
IDLE, which is the standard python editor.


I have Python version 2.3 installed. Start Menu->Python 2.3->IDLE (Python GUI)

When mine opens it shows this:


Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************

IDLE 1.0.5
>>>


The last line is where you can type the current command. Python, unlike C++, does not need to be compiled so you can type a command directly. A simple command is just
>>> 2+2

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!