Book description
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 them for you?
In this fully revised second edition of the best-selling classic 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. You’ll learn the basics Python and explore Python’s rich library of modules for performing specific tasks, like scraping data off websites, reading PDF and Word documents, and automating clicking and typing tasks.
The second edition of this international fan favorite includes a brand-new chapter on input validation, as well as tutorials on automating Gmail and Google Sheets, plus tips on automatically updating CSV files. You’ll learn how to create programs that effortlessly perform useful feats of automation to:
•Search for text in a file or across multiple files
•Create, update, move, and rename files and folders
•Search the Web and download online content
•Update and format data in Excel spreadsheets of any size
•Split, merge, watermark, and encrypt PDFs
•Send email responses and text notifications
•Fill out online forms
Step-by-step instructions walk you through each program, and updated practice projects at the end of each chapter challenge you to improve those programs and use your newfound skills to automate similar tasks.
Don't spend your time doing work a well-trained monkey could do. Even if you've never written a line of code, you can make your computer do the grunt work. Learn how in Automate the Boring Stuff with Python, 2nd Edition.
Table of contents
- Cover Page
- Title Page
- Copyright Page
- Dedication
- About the Author
- About the Technical Reviewer
- BRIEF CONTENTS
- CONTENTS IN DETAIL
- ACKNOWLEDGMENTS
- INTRODUCTION
- PART I: PYTHON PROGRAMMING BASICS
- 1 PYTHON BASICS
-
2 FLOW CONTROL
- Boolean Values
- Comparison Operators
- Boolean Operators
- Mixing Boolean and Comparison Operators
- Elements of Flow Control
- Program Execution
- Flow Control Statements
- Importing Modules
- Ending a Program Early with the sys.exit() Function
- A Short Program: Guess the Number
- A Short Program: Rock, Paper, Scissors
- Summary
- Practice Questions
- 3 FUNCTIONS
- 4 LISTS
- 5 DICTIONARIES AND STRUCTURING DATA
-
6 MANIPULATING STRINGS
- Working with Strings
- Putting Strings Inside Other Strings
- Useful String Methods
- Numeric Values of Characters with the ord() and chr() Functions
- Copying and Pasting Strings with the pyperclip Module
- Project: Multi-Clipboard Automatic Messages
- Project: Adding Bullets to Wiki Markup
- A Short Progam: Pig Latin
- Summary
- Practice Questions
- Practice Projects
- PART II: AUTOMATING TASKS
-
7 PATTERN MATCHING WITH REGULAR EXPRESSIONS
- Finding Patterns of Text Without Regular Expressions
- Finding Patterns of Text with Regular Expressions
- More Pattern Matching with Regular Expressions
- Greedy and Non-greedy Matching
- The findall() Method
- Character Classes
- Making Your Own Character Classes
- The Caret and Dollar Sign Characters
- The Wildcard Character
- Review of Regex Symbols
- Case-Insensitive Matching
- Substituting Strings with the sub() Method
- Managing Complex Regexes
- Combining re.IGNORECASE, re.DOTALL, and re.VERBOSE
- Project: Phone Number and Email Address Extractor
- Summary
- Practice Questions
- Practice Projects
- 8 INPUT VALIDATION
- 9 READING AND WRITING FILES
- 10 ORGANIZING FILES
- 11 DEBUGGING
-
12 WEB SCRAPING
- Project: mapIt.py with the webbrowser Module
- Downloading Files from the Web with the requests Module
- Saving Downloaded Files to the Hard Drive
- HTML
- Parsing HTML with the bs4 Module
- Project: Opening All Search Results
- Project: Downloading All XKCD Comics
- Controlling the Browser with the selenium Module
- Summary
- Practice Questions
- Practice Projects
-
13 WORKING WITH EXCEL SPREADSHEETS
- Excel Documents
- Installing the openpyxl Module
- Reading Excel Documents
- Project: Reading Data from a Spreadsheet
- Writing Excel Documents
- Project: Updating a Spreadsheet
- Setting the Font Style of Cells
- Font Objects
- Formulas
- Adjusting Rows and Columns
- Charts
- Summary
- Practice Questions
- Practice Projects
- 14 WORKING WITH GOOGLE SHEETS
- 15 WORKING WITH PDF AND WORD DOCUMENTS
- 16 WORKING WITH CSV FILES AND JSON DATA
- 17 KEEPING TIME, SCHEDULING TASKS, AND LAUNCHING PROGRAMS
-
18 SENDING EMAIL AND TEXT MESSAGES
- Sending and Receiving Email with the Gmail API
- SMTP
- Sending Email
- IMAP
- Retrieving and Deleting Emails with IMAP
- Project: Sending Member Dues Reminder Emails
- Sending Text Messages with SMS Email Gateways
- Sending Text Messages with Twilio
- Project: “Just Text Me” Module
- Summary
- Practice Questions
- Practice Projects
- 19 MANIPULATING IMAGES
-
20 CONTROLLING THE KEYBOARD AND MOUSE WITH GUI AUTOMATION
- Installing the pyautogui Module
- Setting Up Accessibility Apps on macOS
- Staying on Track
- Controlling Mouse Movement
- Controlling Mouse Interaction
- Planning Your Mouse Movements
- Working with the Screen
- Image Recognition
- Getting Window Information
- Controlling the Keyboard
- Setting Up Your GUI Automation Scripts
- Review of the PyAutoGUI Functions
- Project: Automatic Form Filler
- Displaying Message Boxes
- Summary
- Practice Questions
- Practice Projects
- A INSTALLING THIRD-PARTY MODULES
- B RUNNING PROGRAMS
- C ANSWERS TO THE PRACTICE QUESTIONS
- INDEX
Product information
- Title: Automate the Boring Stuff with Python, 2nd Edition
- Author(s):
- Release date: November 2019
- Publisher(s): No Starch Press
- ISBN: 9781593279929
You might also like
book
Automate the Boring Stuff with Python
Automate the Boring Stuff with Python teaches simple programming skills to automate everyday computer tasks.
book
Python Crash Course, 3rd Edition
Python Crash Course is the world's best-selling guide to the Python guide programming language, with over …
book
Fluent Python, 2nd Edition
Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets …
book
Python Crash Course, 2nd Edition
This is the second edition of the best selling Python book in the world. Python Crash …