Python Automation For Dummies

Author:   Alan Simpson
Publisher:   John Wiley & Sons Inc
ISBN:  

9781394371426


Pages:   368
Publication Date:   04 December 2025
Format:   Paperback
Availability:   Awaiting stock   Availability explained


Our Price $57.95 Quantity:  
Pre-Order

Share |

Python Automation For Dummies


Overview

Streamline Your Workflow and Boost Productivity with Python Automation In today's workplaces, there's a high demand for know-how on the Python programming language, especially for writing time-saving scripts that can simplify routine work tasks. Python Automation For Dummies delivers, with simple explanations of how you can use Python to automatically wrangle data files, manage media files, create shortcuts, find and organize web data, and even analyze social media for trends. With this easy-to-follow Dummies guide, you can upskill, expand your productivity, and speed up the process of generating data-driven insights. You'll even learn to enhance your Python automations with AI, for workflows that are faster and smarter. Review the basics of Python coding and follow steps for automating all sorts of tasks Manage large file sets, organize and analyze data, and speed up research processes Automate scheduling and other time-consuming tasks—and optimize work with AI Free up time and resources by automating routine work, so you can foucs on more important issues This is a great Dummies resource for Python developers interested in applying the popular coding language to make workflows more efficient.

Full Product Details

Author:   Alan Simpson
Publisher:   John Wiley & Sons Inc
Imprint:   For Dummies
Dimensions:   Width: 18.30cm , Height: 2.30cm , Length: 22.90cm
Weight:   0.522kg
ISBN:  

9781394371426


ISBN 10:   139437142
Pages:   368
Publication Date:   04 December 2025
Audience:   Professional and scholarly ,  Professional & Vocational
Format:   Paperback
Publisher's Status:   Forthcoming
Availability:   Awaiting stock   Availability explained

Table of Contents

Introduction 1 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 2 Beyond the Book 2 Where to Go from Here 3 Part 1: Getting Started with Python Automation 5 Chapter 1: Automating with Python 7 Choosing a Programming Language 8 Understanding Python Syntax 10 Getting Python 11 Identifying the hardware requirements 11 Installing Python 12 Chapter 2: Choosing a Code Editor 15 Installing VS Code 16 Installing Python Extensions 18 Creating a Folder for a New Project 19 Opening a project’s folder in VS Code 20 Selecting your Python version 21 Opening the Terminal in VS Code 22 Checking your Python version 23 Using Virtual Environments 24 Creating a virtual environment 25 Activating a virtual environment 26 Installing Modules 28 Writing and Running Python Scripts 30 Writing a Python script 30 Running a Python script 32 Chapter 3: Python Basics for Automation 35 Understanding Python Comments 35 Mastering Variables and Data Types 36 Working with numbers 37 Working with text (strings) 38 Deciding true or false with Booleans 39 Using lists 39 Making immutable lists with tuples 40 Defining key–value pairs in dictionaries 40 Leaving things hanging with None 41 Formatting Output 42 Dealing with Dates and Times 45 Manipulating Data with Operators 47 Using arithmetic and string operators 47 Using assignment operators 48 Recognizing other operators 49 Getting Loopy with Loops 51 Looping with for 51 Looping for a while 52 Bailing out of loops 53 Making Decisions 55 Deciding with if else 55 Compacting decisions with a ternary operator 56 Deciding with match 57 Defining Python Functions 58 Defining default values for parameters 60 Using type hints in Python functions 60 Creating Classes and Objects 61 Handling Exceptions 63 Part 2: Automating Common Computer Tasks 67 Chapter 4: Automating Files and Folders 69 Demystifying the Buzzwords 70 Drives, directories, folders, and files 71 Absolute versus relative paths 72 Backslashes in Windows paths 73 Playing It Safe 74 Navigating Folders and Files 74 Organizing Files by Type 81 Using mkdir for subfolders 86 Moving files with shutil 86 Making the script your own 87 Renaming Files in Bulk 87 Renaming files with Python 90 Using the bulk renaming script 91 Chapter 5: Automating File Management 93 Deleting Old and Temporary Files 93 Identifying old files 96 Matching the file pattern 96 Sending files to the trash 97 Using the deletion script safely 97 Backing Up Files 98 Creating folders from Python 101 Copying files with Python 101 Personalizing the backup script 102 Finding and Removing Duplicate Files 103 Calculating a file hash 106 Finding duplicate files 107 Deleting duplicate files 108 Tweaking the find duplicates script 108 Compressing Files 109 Compressing files with Python 112 Setting your compression parameters 113 Decompressing Files 114 Unzipping files with Python 116 Using the decompression script 117 Chapter 6: Automating Image and Video Files 119 Resizing, Rotating, Flipping, and Cropping Images 120 Resizing images 125 Rotating images 126 Flipping images 126 Cropping images 127 Customizing the image processor 128 Converting Image File Types 129 Converting files with Python 131 Personalizing the conversion script 132 Extracting Frames from Video Files 133 Importing modules for video extraction 135 Looping through a video 136 Tweaking the video conversion script 138 Chapter 7: Automating Mouse and Keyboard 139 Granting Permissions on a Mac 140 Moving the Mouse, Clicking, Dragging, and Scrolling 141 Understanding screen coordinates 141 Controlling the mouse speed 141 Stopping a wild mouse 142 Finding the screen locations of things 142 Using mouse control with a specific app 144 Trying out mouse control 144 Typing Text with Python 146 Controlling the typing speed 147 Typing long passages of text 147 Pressing special keys 148 Pressing hotkeys 148 Detecting the operating system 149 Detecting Keystrokes 150 Creating Your Own Keyboard Shortcuts 151 Automating Screenshots 155 Taking screenshots with Python 157 Personalizing the auto screenshot script 158 Chapter 8: Automating the Office 159 Automating Microsoft Word 159 Naming your Word document 162 Defining your Word content 163 Automating Microsoft Excel 164 Specifying your workbook 167 Defining content for your workbook 167 Creating and Opening PDFs 168 Defining content for your PDF 172 Identifying your PDF 172 Watermarking PDFs 173 Creating your watermark image 176 Adapting the script to your needs 177 Part 3: Automating the Internet 179 Chapter 9: Interacting with APIs 181 Obtaining API Keys 181 Safely Storing API Keys 182 Creating a .gitignore file 184 Using an API key in your script 185 Handling JSON Data 185 Parsing and serializing JSON data 187 Reading and writing JSON files 188 Understanding REST APIs 190 Making API requests 191 Parsing API responses 193 Reviewing a Complete REST API Script 194 Chapter 10: Automating the Web 197 Automating Web Browsers 197 Loading drivers for your browser 198 Finding text boxes to fill 200 Automating Filling Forms Online 201 Finding a control 203 Submitting a form with Enter 204 Filling Multiple Text Boxes 204 Clicking a form’s Submit button 207 Adapting the script to your needs 207 Filling Text Boxes from a File 208 Chapter 11: Scraping Web Pages 213 Picking the Right Tools for Web Scraping 213 Scraping Links from a Web Page 214 Sending a browser header 215 Parsing a web page 216 Extracting Data from a Web Page 217 Finding elements to scrape 218 Scraping data from the page 221 Automating Data Extraction 222 Determining whether a business is open 225 Scraping stock market data 227 Chapter 12: Automating Email and Text Messages 229 Sending Bulk Email Automatically 229 Collecting account information 230 Creating a .env file 230 Creating your email-sending script 231 Sending HTML mail 234 Putting email recipient addresses in a file 235 Automatically Sending Text Messages 236 Storing SMS account information 237 Defining your recipient list and message 239 Storing recipient numbers 239 Chapter 13: Automating Social Media 243 Acquiring API Keys and Modules 243 Automating Posting 244 Setting up your project 245 Making the script your own 249 Creating Content for Your Posts 249 Tracking Performance Metrics 251 Getting Instagram API access 251 Setting up your script 251 Defining your metrics and timeframe 254 Analyzing Trends 255 Viewing the trends 257 Setting your own keywords and timeframe 257 Part 4: Automating More Advanced Stuff 259 Chapter 14: Scheduling Tasks. 261 Using the Schedule Module 261 Understanding how the schedule module works 263 Scheduling tasks for intervals 264 Using the APScheduler Module 265 Using APScheduler with intervals 267 Using APScheduler with dates and times 268 Automating Python Scripts 271 Running scripts as subprocesses 271 Running scripts as imports 274 Chapter 15: Integrating with Artificial Intelligence 277 Accessing Free AI through an API 277 Warming Up to a Local Chatbot 282 Installing and running Ollama 283 Downloading AI models with Ollama 283 Building a simple local chatbot 284 Creating a Conversational Chatbot 287 Developing an AI Image Generator 290 Showing the generated image onscreen 295 Hitting up Hugging Face 301 Part 5: the Part of Tens 309 Chapter 16: Top Ten Zen of Python Guidelines 311 Beautiful Is Better than Ugly 311 Explicit Is Better than Implicit 314 Using type hints 315 Using comments 316 Handling errors 316 Simple Is Better than Complex 317 Complex Is Better than Complicated 320 Flat Is Better than Nested 321 Flattening nested conditionals 321 Using list comprehension 322 Sparse Is Better than Dense 324 Readability Counts 325 Special Cases Aren’t Special Enough to Break the Rule 326 Practicality Beats Purity 328 Errors Should Never Pass Silently 329 Chapter 17: Top Ten Python Error Messages 331 Command Not Found 331 No Module Named 333 SyntaxError 334 NameError 335 TypeError 336 IndexError 337 KeyError 339 AttributeError 340 ModuleNotFoundError 342 FileNotFoundError 343 IndentationError 345 Index 347

Reviews

Author Information

Alan Simpson is a veteran technology writer and educator with extensive experience covering topics from programming languages to the Windows operating system. He’s the author of Windows 11 For Dummies, 2nd Edition, and a co-author of Python All-in-One For Dummies.

Tab Content 6

Author Website:  

Countries Available

All regions
Latest Reading Guide

NOV RG 20252

 

Shopping Cart
Your cart is empty
Shopping cart
Mailing List