Automate the boring stuff with Python

Automate the boring stuff with Python

Al Sweigart

📅 Finished on: 2020-12-24

💻 IT
⭐️ ⭐⭐⭐⭐⭐

With Python, you can automate any boring and predictable task

Masterful, it explains Python in a very useful context and opened my eyes to automation, helpful for work. It was the first technical book I read and it taught me so much! The sections on Regex, PyAutoGUI, Selenium, Pyperclip, and editing Excel, TXT, and Word are excellent. I list all the chapters as a reminder in case I reread it in the future, and there are very interesting exercises to do later, especially with Scraping, AutoGUI, and the basics. The first part is a bit basic, the rest is excellent. I read it quickly.

  • Python Basics, Flow Control, defining Functions, Lists, Dictionaries, and Strings. I need to review dictionaries, but I went through the rest fairly quickly
  • Pattern Matching with Regular Expressions. Excellent; when it created the little program to extract emails from text I was very impressed. Great, with lots of potential
  • Input validation: useful if you want users to fill fields correctly, there are specific libraries
  • Reading and Writing files: introduces os.walk and os.listdir, useful if you want to explore folders. Not bad
  • Organizing files: shutil and zip, some tricks for moving files
  • Debugging: raise Exception to create specific errors and then show them (useful), or assert to block if there are serious errors
  • Web Scraping (BS4, urllib, Selenium): outstanding, very clever, how to pull data from the web
  • Working with Excel Spreadsheets: nice tricks for working in Excel, though I would use pandas for most cases
  • Working with Google Sheets: a nice variant, you need the API but otherwise it is similar
  • Working with PDF and WordDocument: you can do only a few things with PDFs, sometimes it reads them. It can rotate them and, interestingly, apply a watermark with merge
  • CSV and JSON: not very necessary for me, since I would use pandas, but it has some tips like removing headers and correctly reading JSON
  • Keeping Time, Scheduling Tasks, and Launching Programs: nice with datetime for scheduling, basic stuff, considering I would use the Windows scheduler
  • Sending Email and SMS: very useful, it explains how to read and send mail and messages (though Twilio can be a bit cumbersome)
  • Manipulating images: plays a bit with a cat photo, crops, resizes, replicates patterns with PIL, but nothing very useful
  • GUI Automation: very nice screen, mouse, and keyboard control, you can do interesting things. To review
  • Appendix B on how to create a quick batch file to run. Essential