Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Al Sweigart

Also check out the new workbook with exercises: Automate the Boring Stuff with Python Workbook The bestselling introduction to Python programming, revised to include the latest Python features, improved explanations, and new chapters about databases and sound files. If you’ve ever spent hours renaming files or updating hundreds of spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do this work for you? In this fully revised third edition of Automate the Boring Stuff with Python, you’ll learn how to use Python to write programs that do in minutes what would take you hours to do by hand—no prior programming experience required. Early chapters will teach you the fundamentals of Python through clear explanations and engaging examples. You’ll write your first Python program; work with strings, lists, dictionaries, and other data structures; then use regular expressions to find and manipulate text patterns. Once you’ve mastered the basics, you’ll tackle projects that teach you to use Python to automate tasks like: • Searching the web, downloading content, and filling out forms • Finding, extracting, and manipulating text and data in files and spreadsheets • Copying, moving, renaming, or compressing saved files on your computer • Splitting, merging, and extracting text from PDFs and Word documents • Interacting with applications through custom mouse and keyboard macros • Managing your inbox, unsubscribing from lists, and sending email or text notifications New to this edition: All code and examples have been thoroughly updated. You’ll also find four new chapters on database integration, speech recognition, and audio and video editing, as well as 16 new programming projects and expanded coverage of developer techniques like creating command line programs.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, beginner-friendly guide to Python that teaches you just enough programming to automate tedious computer tasks—file management, web scraping, spreadsheet wrangling, and more—so you can save hours of manual work without needing a computer science background. 【Book Arc】 - **Opening (~0%–16%)**: Introduces the book’s promise—automation for non-programmers—and lays out the full roadmap, from Python basics to advanced topics like speech recognition and database integration. The preface and table of contents set expectations for a practical, project-driven journey. - **Early (~16%–28%)**: Covers the absolute fundamentals of Python: data types (integers, floats, strings), variables, and your first programs using `print()`, `input()`, and type-conversion functions. This stage solves the problem of absolute beginners having zero coding vocabulary. - **Early (~28%–36%)**: Builds on the basics with flow control—`if`/`else`/`elif` statements, Boolean logic, and comparison operators—then moves into loops (`while`, `for`, `range()`) and functions. Short programs like "Guess the Number" and "Rock, Paper, Scissors" make abstract concepts tangible. - **Middle (~36%–52%)**: Deepens core skills with debugging techniques (logging, breakpoints, the Mu debugger) and data structures: lists, tuples, dictionaries, and references. This stage is crucial for writing reliable code and organizing data effectively before tackling real-world automation. - **Late (~52%–100%)**: Shifts fully into automation territory. Based on the table of contents, this includes regular expressions, file I/O, organizing files, command-line programs, web scraping, Excel/Google Sheets, SQLite databases, PDF/Word documents, CSV/JSON/XML, scheduling, email/text notifications, image manipulation, OCR, keyboard/mouse control, and text-to-speech/speech recognition. This is where the book delivers on its title, turning skills into time-saving tools. 【Key Takeaways】 - **No prior experience required** (Opening): The book is explicitly designed for total beginners, with clear explanations and engaging examples that assume zero programming background. This makes it an ideal first Python book for non-developers. - **Fundamentals are taught through practical examples** (Early): Instead of abstract theory, you learn data types, variables, and functions via short, runnable programs. This approach keeps motivation high and reinforces learning by doing. - **Flow control and loops are the backbone of logic** (Early): Mastering `if`/`else`, `while`, and `for` loops is essential for any automation script. The book’s mini-projects (like "Guess the Number") make these concepts stick. - **Debugging is a first-class skill** (Middle): A dedicated chapter covers logging, breakpoints, and the Mu debugger, teaching you to systematically find and fix errors—a critical skill for writing automation that runs unattended. - **Data structures matter for real tasks** (Middle): Lists, tuples, and dictionaries are covered in depth, including mutable vs. immutable types and references. This knowledge is essential for handling data in files, spreadsheets, and web content later. - **Automation spans files, web, and office docs** (Late): The book’s core value is in chapters covering file organization, web scraping, Excel/Google Sheets, PDFs/Word, and CSV/JSON/XML. These are the tasks that eat up hours in daily work. - **Beyond the basics: databases, images, and speech** (Late): New to this edition are chapters on SQLite, text-to-speech/speech recognition, and audio/video editing, expanding the scope from office tasks to broader system automation. 【Reading Tips】 - **Skim the first two chapters if you’ve coded before**: If you already know basic programming, the early chapters on data types and flow control will be review. Jump ahead to Chapter 6 (Lists) or Chapter 9 (Regular Expressions) to get to new material faster. - **Deep-read the debugging chapter**: Chapter 5 is short but invaluable. Learning logging and breakpoints early will save you hours of frustration on later projects. - **Do the practice programs**: The book includes "Practice Programs" at the end of chapters (e.g., "Comma Code," "Coin Flip Streaks"). These are small but reinforce the exact skills you’ll need for automation. - **Treat Part II as a reference library**: Once you hit the automation chapters, you don’t need to read linearly. Pick the chapter that matches your pain point—spreadsheets, PDFs, email—and dive in as needed. - **Watch for the companion workbook**: The blurb mentions a separate workbook with exercises. If you learn best by doing, consider pairing it with the main text for extra practice. 【Coverage Limits】 This guide is based on the book’s front matter, table of contents, and early chapter outlines. It does not cover the specific code examples, project walkthroughs, or detailed explanations found in the later automation chapters—those require reading the full text.
Excerpt 1
developer techniques like creating command line programs. PRAISE FOR AUTOMATE THE BORING STUFF WITH PYTHON “If you are new to Python, get this book. . . . If...
View in text
Page 11
. . . . . . . 289 Chapter 14: Excel Spreadsheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 Chapter 15: Google She...
View in text
Page 11
. . 23 Practice Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2 IF-ELSE AND FLOW CONTROL 27...
View in text
Page 15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Concatenation and Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Page 16
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 F-String Alternatives: %s and format() . . . . ....
View in text
Page 11
. . . . . . . . 232 Using with Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Saving Variables with the shelve...
View in text
Page 19
dows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 macOS . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Page 20
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 Sending Special Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Tags
AI categories
PythonProgrammingBackend
ISBN: 1718503415
Publisher: No Starch Press
Publish Year: 2025
Language: English
Pages: 675
File Format: PDF
File Size: 8.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…