This is the source code for Beginning Python : From Novice to Professional, second edition. Each code listing in the book can be found in a correspondingly numbered directory/file. In order to work properly together, some of these may need to be renamed (as indicated by the book). Chapter02/listing2-1.py: Indexing Example Chapter02/listing2-2.py: Slicing Example Chapter02/listing2-3.py: Sequence (String) Multiplication Example Chapter02/listing2-4.py: Sequence Membership Example Chapter03/listing3-1.py: String Formatting Example Chapter04/listing4-1.py: Dictionary Example Chapter04/listing4-2.py: Dictionary Method Example Chapter10/listing10-1.py: A Simple Module Chapter10/listing10-2.py: A Simple Module Containing a Function Chapter10/listing10-3.py: A Simple Module with Some Problematic Test Code Chapter10/listing10-4.py: A Module with Conditional Test Code Chapter10/listing10-5.py: Reversing and Printing Command-Line Arguments Chapter10/listing10-6.py: Adding Line Numbers to a Python Script Chapter10/listing10-7.py: The Line Numbering Program with Line Numbers Added Chapter10/listing10-8.py: A Simple Database Application Chapter10/listing10-10.py: A Program for Finding the Sender of an E-mail Chapter10/listing10-11.py: A Template System Chapter10/listing10-12.txt: A Simple Template Example Chapter10/listing10-13.txt: Some Template Definitions Chapter10/listing10-14.txt: A Template Chapter11/listing11-1.py: Simple Script That Counts the Words in sys.stdin Chapter11/listing11-2.txt: A File Containing Some Nonsensical Text Chapter11/listing11-3.txt: A Simple Text File Chapter11/listing11-4.txt: The Modified Text File Chapter11/listing11-5.txt: The Text File, Modified Again Chapter11/listing11-6.py: Looping over Characters with read Chapter11/listing11-7.py: Writing the Loop Differently Chapter11/listing11-8.py: Using readline in a while Loop Chapter11/listing11-9.py: Iterating over Characters with read Chapter11/listing11-10.py: Iterating over Lines with readlines Chapter11/listing11-11.py: Iterating over Lines with fileinput Chapter11/listing11-12.py: Iterating over a File Chapter11/listing11-13.py: Iterating over a File Without Storing the File Object in a Variable Chapter12/listing12-1.py: Creating and Showing a Frame Chapter12/listing12-2.py: Adding a Button to a Frame Chapter12/listing12-3.py: Adding Labels and Titles with Keyword Arguments Chapter12/listing12-4.py: Setting Button Positions Chapter12/listing12-5.py: Using a Sizer Chapter12/listing12-6.py: The Final GUI Program Chapter13/listing13-1.py: Importing Data into the Database (importdata.py) Chapter13/listing13-2.py: Food Database Query Program (food_query.py) Chapter14/listing14-1.py: A Minimal Server Chapter14/listing14-2.py: A Minimal Client Chapter14/listing14-3.py: A SocketServer-Based Minimal Server Chapter14/listing14-4.py: A Forking Server Chapter14/listing14-5.py: A Threading Server Chapter14/listing14-6.py: A Simple Server Using select Chapter14/listing14-7.py: A Simple Server Using poll Chapter14/listing14-8.py: A Simple Server Using Twisted Chapter14/listing14-9.py: An Improved Logging Server, Using the LineReceiver Protocol Chapter15/listing15-1.py: A Simple Screen Scraping Program Chapter15/listing15-2.py: A Screen Scraping Program Using the HTMLParser Module Chapter15/listing15-3.py: A Screen Scraping Program Using Beautiful Soup Chapter15/listing15-4.py: A Simple CGI Script Chapter15/listing15-5.py: A CGI Script That Invokes a Traceback (faulty.cgi) Chapter15/listing15-6.py: A CGI Script That Retrieves a Single Value from a FieldStorage (simple2.cgi) Chapter15/listing15-7.py: A Greeting Script with an HTML Form (simple3.cgi) Chapter15/listing15-8.psp: A Slightly Stochastic PSP Example Chapter15/listing15-9.py: Simple Authentication with the mod_python Publisher Chapter15/listing15-1.py: A Simple Screen Scraping Program Chapter16/listing16-1.py: A Simple Test Program Chapter16/listing16-2.py: A Simple Test Using the unittest Framework Chapter16/listing16-3.py: Calling External Checkers Using the subprocess Module Chapter17/listing17-1.java: A Simple Java Class (JythonTest.java) Chapter17/listing17-2.cs: A Simple C# Class (IronPythonTest.cs) Chapter17/listing17-3.c: A Simple C Function for Detecting a Palindrome (palindrome.c) Chapter17/listing17-4.py: Detecting Palindromes in Python Chapter17/listing17-5.i: Interface to the Palindrome Library (palindrome.i) Chapter17/listing17-6.c: Palindrome Checking Again (palindrome2.c) Chapter18/listing18-1.py: Simple Distutils Setup Script (setup.py) Chapter19/listing19-1.cfg: A Simple Configuration File Chapter19/listing19-2.py: A Program Using ConfigParser Chapter19/listing19-3.py: A Program Using the logging Module Chapter20/listing20-1.txt: A Sample Plain-Text Document (test_input.txt) Chapter20/listing20-2.py: A Text Block Generator (util.py) Chapter20/listing20-3.py: A Simple Markup Program (simple_markup.py) Chapter20/listing20-4.py: The Handlers (handlers.py) Chapter20/listing20-5.py: The Rules (rules.py) Chapter20/listing20-6.py: The Main Program (markup.py) Chapter21/listing21-1.py: A Simple ReportLab Program (hello_report.py) Chapter21/listing21-2.py: The First Prototype for the Sunspot Graph Program (sunspots_proto.py) Chapter21/listing21-3.py: The Final Sunspot Program (sunspots.py) Chapter22/listing22-1.xml: A Simple Web Site Represented As an XML File (website.xml) Chapter22/listing22-2.py: A Simple Page Maker Script (pagemaker.py) Chapter22/listing22-3.py: The Web Site Constructor (website.py) Chapter23/listing23-1.py: A Simple News-Gathering Agent (newsagent1.py) Chapter23/listing23-2.py: A More Flexible News-Gathering Agent (newsagent2.py) Chapter24/listing24-1.py: A Minimal Server Program Chapter24/listing24-2.py: A Server That Accepts Connections Chapter24/listing24-3.py: The Basic Server with Some Cleanups Chapter24/listing24-4.py: Server Program with ChatSession Class Chapter24/listing24-5.py: A Simple Chat Server (simple_chat.py) Chapter24/listing24-6.py: A Slightly More Complicated Chat Server (chatserver.py) Chapter25/listing25-1.py: A Simple Web Editor (simple_edit.cgi) Chapter25/listing25-2.py: The Editor Script (edit.cgi) Chapter25/listing25-3.py: The Saving Script (save.cgi) Chapter26/listing26-1.sql: Creating the Database in PostgreSQL Chapter26/listing26-2.sql: Creating the Database in MySQL Chapter26/listing26-3.sql: Creating the Database in SQLite Chapter26/listing26-4.py: The Main Bulletin Board (simple_main.cgi) Chapter26/listing26-5.py: The Main Bulletin Board (main.cgi) Chapter26/listing26-6.py: The Message Viewer (view.cgi) Chapter26/listing26-7.py: The Message Editor (edit.cgi) Chapter26/listing26-8.py: The Save Script (save.cgi) Chapter27/listing27-1.py: A Simple Node Implementation (simple_node.py) Chapter27/listing27-2.py: A New Node Implementation (server.py) Chapter27/listing27-3.py: A Node Controller Interface (client.py) Chapter28/listing28-1.py: A Simple GUI Client (simple_guiclient.py) Chapter28/listing28-2.py: The Finished GUI Client (guiclient.py) Chapter29/listing29-1.py: A Simple “Falling Weights” Animation (weights.py) Chapter29/listing29-2.py: The Squish Configuration File (config.py) Chapter29/listing29-4.py: The Main Game Module (squish.py)
shenjiefeng/beginning_python_source_code
Source codes of the book "Beginning Python From Novice to Professional (Second Edition)"
Python