更新时间:2021-07-16 13:53:31
封面
版权信息
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Chapter 1. Getting Started
Installation or upgrade
Using the Read-Evaluate-Print Loop (REPL)
Interacting with the help subsystem
Creating simple script files
The Python ecosystem
Looking at other Python interpreters
Summary
Chapter 2. Simple Data Types
Introducing the built-in operators
The numeric tower
The math libraries
Using bits and Boolean values
Working with sequences
Using string and bytes values
Using the tuple collection
The None object
The consequences of immutability
Using the built-in conversion functions
Chapter 3. Expressions and Output
Expressions operators and data types
The print() function
Examining syntax rules
Splitting partitioning and joining strings
Summary of the standard string libraries
Chapter 4. Variables Assignment and Scoping Rules
Simple assignment and variables
Multiple assignment
Using the head *tail assignment
Augmented assignment
The input() function
Python language concepts
The Python namespace concept
Chapter 5. Logic Comparisons and Conditions
Boolean data and the bool() function
Comparison operators
Logic operators – and or not if-else
The if-elif-else statement
The pass statement as a placeholder
The assert statement
The logic of the None object
Chapter 6. More Complex Data Types
The mutability and immutability distinction
Using the list collection
Using collection functions
Using the set collection
Mappings
Processing collections with the for statement
Iterating with the while statement
The continue and break statements
Using the else clause on a loop
Chapter 7. Basic Function Definitions
Looking at the five kinds of callables
Defining functions with positional parameters
Mutable and immutable argument values
Defining optional parameters via default values
Using the "everything else" notations of * and **
Nested function definitions
Working with namespaces
Defining lambdas
Writing additional function annotations
Chapter 8. More Advanced Functions
Using the for statement with iterable collections
Consequences and next steps
Using generator expressions and comprehensions
Defining generator functions with the yield statement
Using the higher-order functions
Using the built-in reductions – max min and reduce
Three ways to sort a sequence
Functional programming design patterns
Chapter 9. Exceptions
The core exception concept
Using the try and except statements
Matching exception classes in an except clause
Creating our own exceptions
Using a finally clause
Use cases for exceptions
Issuing warnings instead of exceptions
Permission versus forgiveness – a Pythonic approach
Chapter 10. Files Databases Networks and Contexts
The essential file concept
Using a context manager via the with statement
Using the shelve module as a database
Web services and Internet protocols
Physical format considerations