12.07.2015 Views

Is Python a

Is Python a

Is Python a

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

# A commentimport sysprint sys.platformprint 2 ** 100There’s not much new here—just an import and two prints again (sys.platform isjust a string that identifies the kind of computer you’re working on; it lives in a modulecalled sys, which you must import to load). You can run this file from a systemcommand line:D:\LP3E\Examples> c:\python25\python script4.pywin321267650600228229401496703205376However, icon clicks allow you to run the file without any typing at all. If you findthis file’s icon—for instance, by selecting My Computer and working your way downon the D drive—you will get the file explorer picture captured in Figure 3-1(Windows XP is being used here). In <strong>Python</strong> 2.5, source files show up with whitebackgrounds on Windows, and byte code files show up with black backgrounds.You will normally want to click (or otherwise run) the source code file, in order topick up your most recent changes. To launch the file here, simply click on the iconfor script4.py.Figure 3-1. On Windows, <strong>Python</strong> program files show up as icons in file explorer windows, and canautomatically be run with a double-click of the mouse (though you might not see printed output orerror messages this way).Clicking File Icons | 43

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

Saved successfully!

Ooh no, something went wrong!