README.txt 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. This is the source code for Beginning Python : From Novice to Professional,
  2. third edition. Each code listing in the book can be found in a correspondingly
  3. numbered directory/file. In order to work properly together, some of these may
  4. need to be renamed (as indicated by the book).
  5. Chapter02/listing2-1.py: Indexing Example
  6. Chapter02/listing2-2.py: Slicing Example
  7. Chapter02/listing2-3.py: Sequence (String) Multiplication Example
  8. Chapter02/listing2-4.py: Sequence Membership Example
  9. Chapter03/listing3-1.py: String Formatting Example
  10. Chapter04/listing4-1.py: Dictionary Example
  11. Chapter04/listing4-2.py: Dictionary Method Example
  12. Chapter10/listing10-1.py: A Simple Module
  13. Chapter10/listing10-2.py: A Simple Module Containing a Function
  14. Chapter10/listing10-3.py: A Simple Module with Some Problematic Test Code
  15. Chapter10/listing10-4.py: A Module with Conditional Test Code
  16. Chapter10/listing10-5.py: Reversing and Printing Command-Line Arguments
  17. Chapter10/listing10-6.py: Adding Line Numbers to a Python Script
  18. Chapter10/listing10-8.py: A Simple Database Application
  19. Chapter10/listing10-10.py: A Program for Finding the Sender of an E-mail
  20. Chapter10/listing10-11.py: A Template System
  21. Chapter10/listing10-12.txt: A Simple Template Example
  22. Chapter10/listing10-13.txt: Some Template Definitions
  23. Chapter10/listing10-14.txt: A Template
  24. Chapter11/listing11-1.py: Simple Script That Counts the Words in sys.stdin
  25. Chapter11/listing11-2.txt: A File Containing Some Nonsensical Text
  26. Chapter11/listing11-3.txt: A Simple Text File
  27. Chapter11/listing11-4.txt: The Modified Text File
  28. Chapter11/listing11-5.txt: The Text File, Modified Again
  29. Chapter11/listing11-6.py: Looping over Characters with read
  30. Chapter11/listing11-7.py: Writing the Loop Differently
  31. Chapter11/listing11-8.py: Using readline in a while Loop
  32. Chapter11/listing11-9.py: Iterating over Characters with read
  33. Chapter11/listing11-10.py: Iterating over Lines with readlines
  34. Chapter11/listing11-11.py: Iterating over Lines with fileinput
  35. Chapter11/listing11-12.py: Iterating over a File
  36. Chapter11/listing11-13.py: Iterating over a File Without Storing the File Object in a Variable
  37. Chapter12/listing12-1.py: Simple GUI Text Editor
  38. Chapter13/listing13-1.py: Importing Data into the Database (importdata.py)
  39. Chapter13/listing13-2.py: Food Database Query Program (food_query.py)
  40. Chapter14/listing14-1.py: A Minimal Server
  41. Chapter14/listing14-2.py: A Minimal Client
  42. Chapter14/listing14-3.py: A SocketServer-Based Minimal Server
  43. Chapter14/listing14-4.py: A Forking Server
  44. Chapter14/listing14-5.py: A Threading Server
  45. Chapter14/listing14-6.py: A Simple Server Using select
  46. Chapter14/listing14-7.py: A Simple Server Using poll
  47. Chapter14/listing14-8.py: A Simple Server Using Twisted
  48. Chapter14/listing14-9.py: An Improved Logging Server, Using the LineReceiver Protocol
  49. Chapter15/listing15-1.py: A Simple Screen Scraping Program
  50. Chapter15/listing15-2.py: A Screen Scraping Program Using the html.parser Module
  51. Chapter15/listing15-3.py: A Screen Scraping Program Using Beautiful Soup
  52. Chapter15/listing15-4.py: A Simple CGI Script
  53. Chapter15/listing15-5.py: A CGI Script That Invokes a Traceback (faulty.cgi)
  54. Chapter15/listing15-6.py: A CGI Script That Retrieves a Single Value from a FieldStorage (simple2.cgi)
  55. Chapter15/listing15-7.py: A Greeting Script with an HTML Form (simple3.cgi)
  56. Chapter16/listing16-1.py: A Simple Test Program
  57. Chapter16/listing16-2.py: A Simple Test Using the unittest Framework
  58. Chapter16/listing16-3.py: Calling External Checkers Using the subprocess Module
  59. Chapter17/listing17-1.java: A Simple Java Class (JythonTest.java)
  60. Chapter17/listing17-2.cs: A Simple C# Class (IronPythonTest.cs)
  61. Chapter17/listing17-3.c: A Simple C Function for Detecting a Palindrome (palindrome.c)
  62. Chapter17/listing17-4.py: Detecting Palindromes in Python
  63. Chapter17/listing17-5.i: Interface to the Palindrome Library (palindrome.i)
  64. Chapter17/listing17-6.c: Palindrome Checking Again (palindrome2.c)
  65. Chapter18/listing18-1.py: Simple Distutils Setup Script (setup.py)
  66. Chapter19/listing19-1.cfg: A Simple Configuration File
  67. Chapter19/listing19-2.py: A Program Using ConfigParser
  68. Chapter19/listing19-3.py: A Program Using the logging Module
  69. Chapter20/listing20-1.txt: A Sample Plain-Text Document (test_input.txt)
  70. Chapter20/listing20-2.py: A Text Block Generator (util.py)
  71. Chapter20/listing20-3.py: A Simple Markup Program (simple_markup.py)
  72. Chapter20/listing20-4.py: The Handlers (handlers.py)
  73. Chapter20/listing20-5.py: The Rules (rules.py)
  74. Chapter20/listing20-6.py: The Main Program (markup.py)
  75. Chapter21/listing21-1.py: A Simple ReportLab Program (hello_report.py)
  76. Chapter21/listing21-2.py: The First Prototype for the Sunspot Graph Program (sunspots_proto.py)
  77. Chapter21/listing21-3.py: The Final Sunspot Program (sunspots.py)
  78. Chapter22/listing22-1.xml: A Simple Web Site Represented As an XML File (website.xml)
  79. Chapter22/listing22-2.py: A Simple Page Maker Script (pagemaker.py)
  80. Chapter22/listing22-3.py: The Web Site Constructor (website.py)
  81. Chapter23/listing23-1.py: A Simple News-Gathering Agent (newsagent1.py)
  82. Chapter23/listing23-2.py: A More Flexible News-Gathering Agent (newsagent2.py)
  83. Chapter24/listing24-1.py: A Minimal Server Program
  84. Chapter24/listing24-2.py: A Server That Accepts Connections
  85. Chapter24/listing24-3.py: The Basic Server with Some Cleanups
  86. Chapter24/listing24-4.py: Server Program with ChatSession Class
  87. Chapter24/listing24-5.py: A Simple Chat Server (simple_chat.py)
  88. Chapter24/listing24-6.py: A Slightly More Complicated Chat Server (chatserver.py)
  89. Chapter25/listing25-1.py: A Simple Web Editor (simple_edit.cgi)
  90. Chapter25/listing25-2.py: The Editor Script (edit.cgi)
  91. Chapter25/listing25-3.py: The Saving Script (save.cgi)
  92. Chapter26/listing26-1.sql: Creating the Database in PostgreSQL
  93. Chapter26/listing26-2.sql: Creating the Database in MySQL
  94. Chapter26/listing26-3.sql: Creating the Database in SQLite
  95. Chapter26/listing26-4.py: The Main Bulletin Board (simple_main.cgi)
  96. Chapter26/listing26-5.py: The Main Bulletin Board (main.cgi)
  97. Chapter26/listing26-6.py: The Message Viewer (view.cgi)
  98. Chapter26/listing26-7.py: The Message Editor (edit.cgi)
  99. Chapter26/listing26-8.py: The Save Script (save.cgi)
  100. Chapter27/listing27-1.py: A Simple Node Implementation (simple_node.py)
  101. Chapter27/listing27-2.py: A New Node Implementation (server.py)
  102. Chapter27/listing27-3.py: A Node Controller Interface (client.py)
  103. Chapter28/listing28-1.py: A Simple GUI Client (simple_guiclient.py)
  104. Chapter28/listing28-2.py: The Finished GUI Client (guiclient.py)
  105. Chapter29/listing29-1.py: A Simple “Falling Weights” Animation (weights.py)
  106. Chapter29/listing29-2.py: The Squish Configuration File (config.py)
  107. Chapter29/listing29-3.py: The Squish Game Objects (objects.py)
  108. Chapter29/listing29-4.py: The Main Game Module (squish.py)