Book description
Easy to understand and fun to read, Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you’ve learned.
You’ll gain a strong foundation in the language, including best practices for testing, debugging, code reuse, and other development tips. This book also shows you how to use Python for applications in business, science, and the arts, using various Python tools and open source packages.
- Learn simple data types, and basic math and text operations
- Use data-wrangling techniques with Python’s built-in data structures
- Explore Python code structure, including the use of functions
- Write large programs in Python, with modules and packages
- Dive into objects, classes, and other object-oriented features
- Examine storage from flat files to relational databases and NoSQL
- Use Python to build web clients, servers, APIs, and services
- Manage system tasks such as programs, processes, and threads
- Understand the basics of concurrency and network programming
Publisher resources
Table of contents
- Preface
- 1. A Taste of Py
-
2. Py Ingredients: Numbers, Strings, and Variables
- Variables, Names, and Objects
- Numbers
-
Strings
- Create with Quotes
- Convert Data Types by Using str()
- Escape with \
- Combine with +
- Duplicate with *
- Extract a Character with []
- Slice with [ start : end : step ]
- Get Length with len()
- Split with split()
- Combine with join()
- Playing with Strings
- Case and Alignment
- Substitute with replace()
- More String Things
- Things to Do
-
3. Py Filling: Lists, Tuples, Dictionaries, and Sets
- Lists and Tuples
-
Lists
- Create with [] or list()
- Convert Other Data Types to Lists with list()
- Get an Item by Using [ offset ]
- Lists of Lists
- Change an Item by [ offset ]
- Get a Slice to Extract Items by Offset Range
- Add an Item to the End with append()
- Combine Lists by Using extend() or +=
- Add an Item by Offset with insert()
- Delete an Item by Offset with del
- Delete an Item by Value with remove()
- Get an Item by Offset and Delete It by Using pop()
- Find an Item’s Offset by Value with index()
- Test for a Value with in
- Count Occurrences of a Value by Using count()
- Convert to a String with join()
- Reorder Items with sort()
- Get Length by Using len()
- Assign with =, Copy with copy()
- Tuples
-
Dictionaries
- Create with {}
- Convert by Using dict()
- Add or Change an Item by [ key ]
- Combine Dictionaries with update()
- Delete an Item by Key with del
- Delete All Items by Using clear()
- Test for a Key by Using in
- Get an Item by [ key ]
- Get All Keys by Using keys()
- Get All Values by Using values()
- Get All Key-Value Pairs by Using items()
- Assign with =, Copy with copy()
- Sets
- Compare Data Structures
- Make Bigger Data Structures
- Things to Do
- 4. Py Crust: Code Structures
- 5. Py Boxes: Modules, Packages, and Programs
-
6. Oh Oh: Objects and Classes
- What Are Objects?
- Define a Class with class
- Inheritance
- Override a Method
- Add a Method
- Get Help from Your Parent with super
- In self Defense
- Get and Set Attribute Values with Properties
- Name Mangling for Privacy
- Method Types
- Duck Typing
- Special Methods
- Aggregation and Composition
- When to Use Classes and Objects versus Modules
- Things to Do
- 7. Mangle Data Like a Pro
- 8. Data Has to Go Somewhere
- 9. The Web, Untangled
-
10. Systems
-
Files
- Create with open()
- Check Existence with exists()
- Check Type with isfile()
- Copy with copy()
- Change Name with rename()
- Link with link() or symlink()
- Change Permissions with chmod()
- Change Ownership with chown()
- Get a Pathname with abspath()
- Get a symlink Pathname with realpath()
- Delete a File with remove()
- Directories
- Programs and Processes
- Calendars and Clocks
- Things to Do
-
Files
- 11. Concurrency and Networks
- 12. Be a Pythonista
- A. Py Art
- B. Py at Work
- C. Py Sci
- D. Install Python 3
-
E. Answers to Exercises
- Chapter 1, A Taste of Py
- Chapter 2, Py Ingredients: Numbers, Strings, and Variables
- Chapter 3, Py Filling: Lists, Tuples, Dictionaries, and Sets
- Chapter 4, Py Crust: Code Structures
- Chapter 5, Py Boxes: Modules, Packages, and Programs
- Chapter 6, Oh Oh: Objects and Classes
- Chapter 7, Mangle Data Like a Pro
- Chapter 8, Data Has to Go Somewhere
- Chapter 9, The Web, Untangled
- Chapter 10, Systems
- Chapter 11, Concurrency and Networks
- F. Cheat Sheets
- Index
Product information
- Title: Introducing Python
- Author(s):
- Release date: November 2014
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449359362
You might also like
book
Introducing Python, 2nd Edition
Easy to understand and fun to read, this updated edition of Introducing Python is ideal for …
book
Serious Python
Sharpen your Python skills as you dive deep into the Python programming language with Serious Python. …
video
Introduction to Python
Intrigued by Python? Learn how to get started with this popular language, whether you’re new to …
book
Fluent Python, 2nd Edition
Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets …