And More Python Books

Lutz, M. (2010) Python Pocket Reference (Pocket Reference (O’Reilly)), Fourth Edition, O’Reilly Media, Inc.

A more recent edition of this book is available

Download eBook PDF (PDF 2,594KB)

This is the book to reach for when you’re coding on the fly and need an answer now. It’s an easy-to-use reference to the core language, with descriptions of commonly used modules and toolkits, and a guide to recent changes, new features, and upgraded built-ins — all updated to cover Python 3.X as well as version 2.6. You’ll also quickly find exactly what you need with the handy index.

Written by Mark Lutz — widely recognized as the world’s leading Python trainer — Python Pocket Reference, Fourth Edition, is the perfect companion to O’Reilly’s classic Python tutorials, also written by Mark: Learning Python and Programming Python.

  • Built-in object types, including numbers, lists, dictionaries, and more
  • Statements and syntax for creating and processing objects
  • Functions and modules for structuring and reusing code
  • Python’s object-oriented programming tools
  • The exception-handling model
  • Built-in functions, exceptions, and attributes
  • Special operator overloading methods
  • Widely used standard library modules and extensions
  • Command-line options and development tools
  • Python idioms and hints
  1. Chapter 1 Python Pocket Reference
    1. Introduction
    2. Conventions
    3. Using Code Examples
    4. Safari® Books Online
    5. Command-Line Options
    6. Environment Variables
    7. Built-in Types and Operators
    8. Specific Built-in Types
    9. Statements and Syntax
    10. Specific Statements
    11. Namespace and Scope Rules
    12. Object-Oriented Programming
    13. Operator Overloading Methods
    14. Built-in Functions
    15. Built-in Exceptions
    16. Built-in Attributes
    17. Standard Library Modules
    18. The sys Module
    19. The string Module
    20. The os System Module
    21. The re Pattern-Matching Module
    22. Object Persistence Modules
    23. The tkinter GUI Module and Tools
    24. Internet Modules and Tools
    25. Other Standard Library Modules
    26. Python Portable SQL Database API
    27. Python Idioms and Hints

Python Projects (111890866X) cover imageCassell, L. and Gauld, A. (2015) Python Projects, John Wiley & Sons, Inc.

Download eBook PDF (PDF 10,297KB)

Download Source Code from: http://eu.wiley.com/WileyCDA/WileyTitle/productCd-111890866X.html

Download Source Code: Chapter 1 (ZIP 6KB),  Chapter 2 (ZIP 23KB), Chapter 3 (ZIP 16KB), Chapter 4 (ZIP 47KB), Chapter 5 (ZIP 9KB), Chapter 6 (ZIP 3KB)

Companion Web Site: http://learning-python.com/books/

A guide to completing Python projects for those ready to take their skills to the next level

Python Projects is the ultimate resource for the Python programmer with basic skills who is ready to move beyond tutorials and start building projects.
The preeminent guide to bridge the gap between learning and doing, this book walks readers through the “where” and “how” of real–world Python programming with practical, actionable instruction. With a focus on real–world functionality, Python Projects details the ways that Python can be used to complete daily tasks and bring efficiency to businesses and individuals alike.
Python Projects is written specifically for those who know the Python syntax and lay of the land, but may still be intimidated by larger, more complex projects. The book provides a walk–through of the basic set–up for an application and the building and packaging for a library, and explains in detail the functionalities related to the projects.

Topics include:

∗How to maximize the power of the standard library modules
∗Where to get third party libraries, and the best practices for utilization
∗Creating, packaging, and reusing libraries within and across projects
∗Building multi–layered functionality including networks, data, and user interfaces
∗Setting up development environments and using virtualenv, pip, and more

Written by veteran Python trainers, the book is structured for easy navigation and logical progression that makes it ideal for individual, classroom, or corporate training.
For Python developers looking to apply their skills to real–world challenges, Python Projects is a goldmine of information and expert insight.

Table of Contents

INTRODUCTION

CHAPTER 1: REVIEWING CORE PYTHON

Exploring the Python Language and the Interpreter

Reviewing the Python Data Types

Numeric Types: Integer and Float

The Boolean Type

The None Type

Collection Types

Strings

Bytes and ByteArrays

Tuples

Lists

Dictionaries

Sets

Using Python Control Structures

Structuring Your Program

Using Sequences, Blocks and Comments

Selecting an Execution Path

Iteration

Handling Exceptions

Managing Context

Getting Data In and Out of Python

Interacting with Users

Using Text Files

Extending Python

Defining and Using Functions

Generator Functions

Lambda Functions

Defining and Using Classes and Objects

Creating and Using Modules and Packages

Using and Creating Modules

Using and Creating Packages

Creating an Example Package

Using Third?]Party Packages

Summary

CHAPTER 2: SCRIPTING WITH PYTHON

Accessing the Operating System

Obtaining Information About Users and Their Computer

Obtaining Information About the Current Process

Managing Other Programs

Managing Subprocesses More Effectively

Obtaining Information About Files (and Devices)

Navigating and Manipulating the File system

Plumbing the Directory Tree Depths

Working with Dates and Times

Using the time Module

Introducing the datetime Module

Introducing the calendar Module

Handling Common File Formats

Using Comma?]Separated Values

Working with Config Files

Working with XML and HTML Files

Parsing XML Files

Parsing HTML Files

Accessing Native APIs with ctypes and pywin32

Accessing the Operating System Libraries

Using ctypes with Windows

Using ctypes on Linux

Accessing a Windows Application Using COM

Automating Tasks Involving Multiple Applications

Using Python First

Using Operating System Utilities

Using Data Files

Using a Third?]Party Module

Interacting with Subprocesses via a CLI

Using Web Services for Server?]Based Applications

Using a Native Code API

Using GUI Robotics

Summary

CHAPTER 3: MANAGING DATA

Storing Data Using Python

Using DBM as a Persistent Dictionary

Using Pickle to Store and Retrieve Objects

Accessing Objects with shelve

Analyzing Data with Python

Analyzing Data Using Built?]In Features of Python

Analyzing Data with ittertools

Utility Functions

Data Processing Functions

Taming the Vagaries of groupby()

Using itertools to Analyze LendyDB Data

Managing Data Using SQL

Relational Database Concepts

Structured Query Language

Creating Tables

Inserting Data

Reading Data

Modifying Data

Linking Data Across Tables

Digging Deeper into Data Constraints

Revisiting SQLite Field Types

Modeling Relationships with Constraints

Many?]to?]Many Relationships

Migrating LendyDB to an SQL Database

Accessing SQL from Python

Using SQL Connections

Using a Cursor

Creating the LendyDB SQL Database

Inserting Test Data

Creating a LendyDB API

Exploring Other Data Management Options

Client?]Server Databases

NoSQL

The Cloud

Data Analysis with RPy

Summary

CHAPTER 4: BUILDING DESKTOP APPLICATIONS

Structuring Applications

Building Command–Line Interfaces

Building the Data Layer

Building the Core Logic Layer

Building the User Interface

Using the cmd Module to Build a Command–Line Interface

Reading Command–Line Arguments

Jazzing Up the Command–Line Interface with Some Dialogs

Programming GUIs with Tkinter

Introducing Key GUI Principles

Event?]Based Programming

GUI Terminology

The Containment Tree

Building a Simple GUI

Building a Tic?]Tac?]Toe GUI

Sketching a UI Design

Building Menus

Building a Tic?]Tac?]Toe Board

Connecting the GUI to the Game

Extending Tkinter

Using Tix

Using ttk

Revisiting the Lending Library

Exploring Other GUI Toolkits for Python

wxPython

PyQt

PyGTK

Native GUIs: Cocoa and PyWin32

Dabo

Storing Local Data

Storing Application?]Specifi c Data

Storing User?]Selected Preferences

Storing Application State

Logging Error information

Understanding Localization

Using Locales

Using Unicode in Python

Using gettext

Summary

CHAPTER 5: PYTHON ON THE WEB

Python on the Web

Parts of a Web Application

The Client?]Server Relationship

Middleware and MVC

HTTP Methods and Headers

What Is an API?

Web Programming with Python

Using the Python HTTP Modules

Creating an HTTP Server

Exploring the Flask Framework

Creating Data Models in Flask

Creating Core Flask Files

More on Python and the Web

Static Site Generators

Web Frameworks

Using Python Across the Wire

XML?]RPC

Socket Servers

More Networking Fun in Python

Summary

CHAPTER 6: PYTHON IN BIGGER PROJECTS

Testing with the Doctest Module

Testing with the Unittest Module

Test?]Driven Development in Python

Debugging Your Python Code

Handling Exceptions in Python

Working on Larger Python Projects

Releasing Python Packages

Summary

CHAPTER 7: EXPLORING PYTHON’S FRONTIERS

Drawing Pictures with Python

Using Turtle Graphics

Using GUI Canvas Objects

Plotting Data

Using imghdr

Introducing Pillow

Trying Out ImageMagick

Doing Science with Python

Introducing SciPy

Doing Bioscience with Python

Using GIS

Watching Your Language

Getting It All

Playing Games with Python

Enriching the Experience with PyGame

Exploring Other Options

Going to the Movies

The Computer Graphics Kit

Modeling and Animation

Photo Processing

Working with Audio

Integrating with Other Languages

Jython

IronPython

Cython

Tcl/Tk

Getting Physical

Introducing Serial Options

Programming the RaspberryPi

Talking to the Arduino

Exploring Other Options

Building Python

Fixing Bugs

Documenting

Testing

Adding Features

Attending Conferences

Summary

APPENDIX A: ANSWERS TO EXERCISES

Chapter 1 Solutions

Chapter 2 Solutions

Chapter 3 Solutions

Chapter 4 Solutions

Chapter 5 Solutions

Chapter 6 Solutions

Chapter 7 Solutions

APPENDIX B: PYTHON STANDARD MODULES

APPENDIX C: USEFUL PYTHON RESOURCES

Asking Questions: Mailing Lists and More

Reading Blogs

Studying Tutorials and References

Watching Videos

And Now for Something Completely Different…


Matthes, E. (2015) Python Crash Course – A Hands-On, Project-Based Introduction to Programming. No Starch Press

Download eBook PDF (PDF KB)
Download Source Code (ZIP KB)

Companion Web Site: https://ehmatthes.github.io/pcc/

Learn Python—Fast!

Python Crash Course is a fast-paced, thorough introduction to Python that will have you writing programs, solving problems, and making things that work in no time.

In the first half of the book, you’ll learn about basic programming concepts, such as lists, dictionaries, classes, and loops, and practice writing clean and readable code with exercises for each topic. You’ll also learn how to make your programs interactive and how to test your code safely before adding it to a project. In the second half of the book, you’ll put your new knowledge into practice with three substantial projects: a Space Invaders–inspired arcade game, data visualizations with Python’s super-handy libraries, and a simple web app you can deploy online.

As you work through Python Crash Course you’ll learn how to:

  • Use powerful Python libraries and tools, including matplotlib, NumPy, and Pygal
  • Make 2D games that respond to keypresses and mouse clicks, and that grow more difficult as the game progresses
  • Work with data to generate interactive visualizations
  • Create and customize Web apps and deploy them safely online
  • Deal with mistakes and errors so you can solve your own programming problems

If you’ve been thinking seriously about digging into programming, Python Crash Course will get you up to speed and have you writing real programs fast. Why wait any longer? Start your engines and code!

Uses Python 2 and 3

Table of Contents

Introduction

PART I: Basics

Chapter 1: Getting Started
Chapter 2: Variables and Simple Data Types
Chapter 3: Introducing Lists
Chapter 4: Working with Lists
Chapter 5: if Statements
Chapter 6: Dictionaries
Chapter 7: User Input and while Loops
Chapter 8: Functions
Chapter 9: Classes
Chapter 10: Files and Exceptions
Chapter 11: Testing Your Code

PART II: Projects

Project 1: Alien Invasion
Chapter 12: A Ship that Fires Bullets
Chapter 13: Aliens!
Chapter 14: Scoring

Project 2: Data Visualization
Chapter 15: Generating Data
Chapter 16: Downloading Data
Chapter 17: Working with APIs

Project 3: Web Applications
Chapter 18: Getting Started with Django
Chapter 19: User Accounts
Chapter 20: Styling and Deploying an App

Afterword

Appendix A: Installing Python
Appendix B: Text Editors
Appendix C: Getting Help
Appendix D: Using Git for Version Control

Python Crash Course – Cheat Sheets

A cheat sheet can be really helpful when you’re trying a set of exercises related to a specific topic, or working on a project. Because you can only fit so much information on a single sheet of paper, most cheat sheets are a simple listing of syntax rules. This set of cheat sheets aims to remind you of syntax rules, but also remind you of important concepts as well.

You can download any individual cheat sheet, or download all the cheat sheets in one document.


Briggs, J. R.  (2012) Python for Kids – A Playful Introduction to Programming, No Starch Press

Download eBook PDF (PDF 14,131KB)
Download Source Code (ZIP 114KB)
Download Solutions to Programming Puzzles (PDF 1,528KB)
Companion Web Site: http://jasonrbriggs.com/python-for-kids/

Python is a powerful, expressive programming language that’s easy to learn and fun to use! But books about learning to program in Python can be kind of dull, gray, and boring, and that’s no fun for anyone.

Python for Kids brings Python to life and brings you (and your parents) into the world of programming. The ever-patient Jason R. Briggs will guide you through the basics as you experiment with unique (and often hilarious) example programs that feature ravenous monsters, secret agents, thieving ravens, and more. New terms are defined; code is colored, dissected, and explained; and quirky, full-color illustrations keep things on the lighter side.

Chapters end with programming puzzles designed to stretch your brain and strengthen your understanding. By the end of the book you’ll have programmed two complete games: a clone of the famous Pong and “Mr. Stick Man Races for the Exit”—a platform game with jumps, animation, and much more.

As you strike out on your programming adventure, you’ll learn how to:

  • Use fundamental data structures like lists, tuples, and maps
  • Organize and reuse your code with functions and modules
  • Use control structures like loops and conditional statements
  • Draw shapes and patterns with Python’s turtle module
  • Create games, animations, and other graphical wonders with tkinter

Why should serious adults have all the fun? Python for Kids is your ticket into the amazing world of computer programming.

For kids ages 10+ (and their parents)

The code in this book runs on almost anything: Windows, Mac, Linux, even an OLPC laptop or Raspberry Pi!

Table of Contents

About the Author and Technical Reviewers
Acknowledgments
Introduction

Part I: Learning to Program

Chapter 1: Not All Snakes Slither
Chapter 2: Calculations and Variables
Chapter 3: Strings, Lists, Tuples, and Maps
Chapter 4: Drawing with Turtles
Chapter 5: Asking Questions with if and else
Chapter 6: Going Loopy
Chapter 7: Recycling Your Code with Functions and Modules
Chapter 8: How to Use Classes and Objects
Chapter 9: Python’s Built-In Functions
Chapter 10: Useful Python Modules
Chapter 11: More Turtle Graphics
Chapter 12: Using tkinter for Better Graphics

Part II: Bounce!

Chapter 13: Beginning Your First Game: Bounce!
Chapter 14: Finishing Your First Game: Bounce!

Part III: Mr. Stick Man Races for the Exit

Chapter 15: Creating Graphics for the Mr. Stick Man Game
Chapter 16: Developing the Mr. Stick Man Game
Chapter 17: Creating Mr. Stick Man
Chapter 18: Completing the Mr. Stick Man Game

Afterword: Where to Go from Here
Appendix: Python Keywords
Glossary