An Overview of Python - What is Python
- The Birth of Python.
- About Interpreted Languages
- Advantages of Python
- Disadvantages of Python
- How to get Python
- Which version of Python
- The end of Python 2
- Getting Help
- One day on Dagobah
The Python Environment - Starting Python
- If the interpreter is not in your PATH
- Using the interpreter
- Trying out a few commands
- Running Python scripts (explicit)
- Running Python scripts (implicit)
- Using pydoc
- Python Editors and IDEs
Getting Started - Using variables
- Keywords and Builtins
- Variable typing
- Strings
- Single-delimited string literals
- Triple-delimited string literals
- Raw string literals
- Unicode characters
- String operators and methods
- String Methods
- Numeric literals
- Math operators and expressions
- Converting among types
- Writing to the screen
- String Formatting
- Legacy String Formatting
- Command line parameters
- Reading from the keyboard
Flow Control - About flow control
- Whats with the white space
- if and elif
- Conditional Expressions
- Relational Operators
- Boolean operators
- while loops
- Alternate ways to exit a loop
Array types - About Array Types
- Lists
- Tuples
- Indexing and slicing
- Iterating through a sequence
- Unpacking tuples
- Nested sequences
- Functions for all sequences
- Using enumerate()
- Operators and keywords for sequences
- The range() function
- List comprehensions
- Generator Expressions
Working with Files - Text file I/O
- Opening a text file
- The with block
- Reading a text file
- Writing to a text file
Dictionaries - About dictionaries
- When to use dictionaries
- Creating dictionaries
- Getting dictionary values
- Iterating through a dictionary
- Reading file data into a dictionary
- Counting with dictionaries
- About sets
- Creating Sets
- Working with sets
Functions - Defining a function
- Returning values
- Function parameters
- Variable scope
Sorting - Sorting Overview
- The sorted() function
- Custom sort keys
- Lambda functions
- Sorting nested data
- Sorting dictionaries
- Sorting in reverse
- Sorting lists in place
Errors and Exception Handling - Syntax errors
- Exceptions
- Handling exceptions with try
- Handling multiple exceptions
- Handling generic exceptions
- Ignoring exceptions
- Using else
- Cleaning up with finally
Using Modules - What is a module
- Creating Modules
- The import statement
- Where did __pycache__ come from
- Module search path
- Packages
- Example
- Module Aliases
- When the batteries arent included
An Introduction to Python Classes - About O-O programming
- Defining classes
- Constructors
- Instance methods
- Properties
- Class methods and data
- Static Methods
- Private methods
- Inheritance
- Untangling the nomenclature
Regular Expressions - Regular Expressions
- RE Syntax Overview
- Finding matches
- RE Objects
- Compilation Flags
- Groups
- Special Groups
- Replacing text
- Replacing with a callback
- Splitting a string
Network Programming - Grabbing a web page
- Consuming Web services
- HTTP the easy way
- sending e-mail
- Email attachments
- Remote Access
- Copying files with Paramiko
Sockets - Sockets
- Socket options
- Server concepts
- Client concepts
- Application protocols
- Forking servers
Multiprogramming - Multiprogramming
- What Are Threads
- The Python Thread Manager
- The threading Module
- Threads for the impatient
- Creating a thread class
- Variable sharing
- Using queues
- Debugging threaded Programs
- The multiprocessing module
- Using pools
- Alternatives to multiprogramming
Efficient Scripting - Running external programs
- Parsing arguments
- Creating filters to read text files
- Logging
Serializing Data: XML, XPath, JSON, CSV - About XML
- Normal Approaches to XML
- Which module to use
- Getting Started With ElementTree
- How ElementTree Works
- Elements
- Creating a New XML Document
- Parsing An XML Document
- Navigating the XML Document
- Using XPath
- About JSON
- Reading JSON
- Writing JSON
- Customizing JSON
- Reading CSV data
- Nonstandard CSV
- Using csv.DictReader
- Writing CSV Data
- Pickle
, Chapter 1: An Overview of Python
What is Python
The Birth of Python.
About Interpreted Languages
Advantages of Python
Disadvantages of Python
How to get Python
Which version of Python
The end of Python 2
Getting Help
One day on Dagobah
Chapter 2: The Python Environment
Starting Python
If the interpreter is not in your PATH
Using the interpreter
Trying out a few commands
Running Python scripts (explicit)
Running Python scripts (implicit)
Using pydoc
Python Editors and IDEs
Chapter 3: Getting Started
Using variables
Keywords and Builtins
Variable typing
Strings
Single-delimited string literals
Triple-delimited string literals
Raw string literals
Unicode characters
String operators and methods
String Methods
Numeric literals
Math operators and expressions
Converting among types
Writing to the screen
String Formatting
Legacy String Formatting
Command line parameters
Reading from the keyboard
Chapter 4: Flow Control
About flow control
What's with the white space
if and elif
Conditional Expressions
Relational Operators
Boolean operators
while loops
Alternate ways to exit a loop
Chapter 5: Array types
About Array Types
Lists
Tuples
Indexing and slicing
Iterating through a sequence
Unpacking tuples
Nested sequences
Functions for all sequences
Using enumerate()
Operators and keywords for sequences
The range() function
List comprehensions
Generator Expressions
Chapter 6: Working with Files
Text file I/O
Opening a text file
The with block
Reading a text file
Writing to a text file
Chapter 7: Dictionaries
About dictionaries
When to use dictionaries
Creating dictionaries
Getting dictionary values
Iterating through a dictionary
Reading file data into a dictionary
Counting with dictionaries
About sets
Creating Sets
Working with sets
Chapter 8: Functions
Defining a function
Returning values
Function parameters
Variable scope
Chapter 9: Sorting
Sorting Overview
The sorted() function
Custom sort keys
Lambda functions
Sorting nested data
Sorting dictionaries
Sorting in reverse
Sorting lists in place
Chapter 10: Errors and Exception Handling
Syntax errors
Exceptions
Handling exceptions with try
Handling multiple exceptions
Handling generic exceptions
Ignoring exceptions
Using else
Cleaning up with finally
Chapter 11: Using Modules
What is a module
Creating Modules
The import statement
Where did __pycache__ come from
Module search path
Packages
Example
Module Aliases
When the batteries aren't included
Chapter 12: An Introduction to Python Classes
About O-O programming
Defining classes
Constructors
Instance methods
Properties
Class methods and data
Static Methods
Private methods
Inheritance
Untangling the nomenclature
Chapter 13: Regular Expressions
Regular Expressions
RE Syntax Overview
Finding matches
RE Objects
Compilation Flags
Groups
Special Groups
Replacing text
Replacing with a callback
Splitting a string
Chapter 14: Network Programming
Grabbing a web page
Consuming Web services
HTTP the easy way
sending e-mail
Email attachments
Remote Access
Copying files with Paramiko
Chapter 15: Sockets
Sockets
Socket options
Server concepts
Client concepts
Application protocols
Forking servers
Chapter 16: Multiprogramming
Multiprogramming
What Are Threads
The Python Thread Manager
The threading Module
Threads for the impatient
Creating a thread class
Variable sharing
Using queues
Debugging threaded Programs
The multiprocessing module
Using pools
Alternatives to multiprogramming
Chapter 17: Closures
What is a closure
Why do I need one
How can I make one
Factory Function
Using functools.partial()
Chapter 18: Serializing Data: XML, CSV
About XML
Normal Approaches to XML
Which module to use
Getting Started With ElementTree
How ElementTree Works
Elements
Creating a New XML Document
Parsing An XML Document
Navigating the XML Document
Using XPath
About JSON
Reading JSON
Writing JSON
Customizing JSON
Reading CSV data
Nonstandard CSV
Using csv.DictReader
Writing CSV Data
Pickle