12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ChapterCHAPTER33How You Run Programs 3OK, it’s time to start running some code. Now that you have a handle on programexecution, you’re finally ready to start some real <strong>Python</strong> programming. At this point,I’ll assume that you have <strong>Python</strong> installed on your computer; if not, see the priorchapter and Appendix A for installation and configuration hints.There are a variety of ways to tell <strong>Python</strong> to execute the code you type. This chapterdiscusses all the program-launching techniques in common use today. Along theway, you’ll learn how to type code interactively, and how to save it in files to be runwith system command lines, icon clicks, module imports, IDE GU<strong>Is</strong> such as IDLEand Eclipse, and more.If you just want to find out how to run a <strong>Python</strong> program quickly, you may betempted to read the parts that pertain only to your platform and move on toChapter 4. But don’t skip the material on module imports, as that’s essential tounderstanding <strong>Python</strong>’s program architecture. I also encourage you at least to skimthe sections on IDLE and other IDEs, so you’ll know what tools are available forwhen you start developing more sophisticated <strong>Python</strong> programs.Interactive CodingPerhaps the simplest way to run <strong>Python</strong> programs is to type them at <strong>Python</strong>’s interactivecommand line. There are a variety of ways to start this command line—in anIDE, from a system console, and so on. Assuming the interpreter is installed as anexecutable program on your system, the most platform-neutral way to start an interactiveinterpreter session is usually just to type python at your operating system’sprompt, without any arguments. For example:% python<strong>Python</strong> 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!