From ad1707cdc8697b29281eca5c968c6f9f92d8d401 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Mon, 27 Jul 2009 17:40:07 -0400 Subject: [PATCH] 3.0 --> 3.1 --- your-first-python-program.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/your-first-python-program.html b/your-first-python-program.html index 5f9124b..c2d1c84 100755 --- a/your-first-python-program.html +++ b/your-first-python-program.html @@ -177,12 +177,12 @@ SyntaxError: non-keyword arg after keyword arg >>> sys.path ['/home/mark/py', '', - '/usr/lib/python30.zip', - '/usr/lib/python3.0', - '/usr/lib/python3.0/plat-linux2@EXTRAMACHDEPPATH@', - '/usr/lib/python3.0/lib-dynload', - '/usr/lib/python3.0/dist-packages', - '/usr/local/lib/python3.0/dist-packages'] + '/usr/lib/python31.zip', + '/usr/lib/python3.1', + '/usr/lib/python3.1/plat-linux2@EXTRAMACHDEPPATH@', + '/usr/lib/python3.1/lib-dynload', + '/usr/lib/python3.1/dist-packages', + '/usr/local/lib/python3.1/dist-packages']
  1. Importing the sys module makes all of its functions and attributes available.
  2. sys.path is a list of directory names that constitute the current search path. (Yours will look different, depending on your operating system, what version of Python you’re running, and where it was originally installed.) Python will look through these directories (in this order) for a .py file whose name matches what you’re trying to import. @@ -341,7 +341,7 @@ if __name__ == '__main__': 'humansize'

    But you can also run the module directly as a standalone program, in which case __name__ will be a special default value, __main__. Python will evaluate this if statement, find a true expression, and execute the if code block. In this case, to print two values.

    -c:\home\diveintopython3> c:\python30\python.exe humansize.py
    +c:\home\diveintopython3> c:\python31\python.exe humansize.py
     1.0 TB
     931.3 GiB

    And that’s your first Python program! @@ -350,9 +350,9 @@ if __name__ == '__main__':

    Further Reading

    © 2001–9 Mark Pilgrim