Automate the Boring Stuff with Python, 2nd Edition: Practical Programming for Total Beginners

by: Al Sweigart (0)

Learn how to code while you write programs that effortlessly perform useful feats of automation!

The second edition of this international fan favorite includes a brand-new chapter on input validation, Gmail and Google Sheets automations, tips for updating CSV files, and more.

If you've ever spent hours renaming files or updating spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do them for you?
Automate the Boring Stuff with Python, 2nd Edition teaches even the technically uninclined how to write programs that do in minutes what would take hours to do by hand—no prior coding experience required!

This new, fully revised edition of Al Sweigart’s bestselling Pythonic classic,
Automate the Boring Stuff with Python, covers all the basics of Python 3 while exploring its rich library of modules for performing specific tasks, like scraping data off the Web, filling out forms, renaming files, organizing folders, sending email responses, and merging, splitting, or encrypting PDFs. There’s also a brand-new chapter on input validation, tutorials on automating Gmail and Google Sheets, tips on automatically updating CSV files, and other recent feats of automations that improve your efficiency.

Detailed, step-by-step instructions walk you through each program, allowing you to create useful tools as you build out your programming skills, 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. Boring tasks no longer have to take to get through—and neither does learning Python!

The Quotes

Python evaluates the not operators first, then the and operators, and then the or operators.

Remember that at most only one of the clauses will be executed, and for elif statements, the order matters!

Comparison operators, also called relational operators, compare two values and evaluate down to a single Boolean value.

The Reviews

This book is intended for beginners, and really breaks down python in a very approachable manner. Despite that being said, I wouldn't recommend this book to a beginner. In the preface, the author mentions that this book uses many bad habits (or at the very least frowned upon habits), which is true. Many of coding examples are inefficient (which, to the author's credit, he acknowledges), and while the code might run, it's not going to be pretty. The projects look worthwhile, and those alone would be what I'd argue makes the book worth it. Many novice developers (as well as intermediate & advanced) can shrug off the idiosyncrasies that are presented in this book, but a person brand new to coding would likely misunderstand the material, ultimately leading to bad habits that'll be harder to unlearn.For a true beginner, I'd recommend the Python Crash Course book by the same publisher (No Starch Press). The fundamentals are clearly presented, and easy to understand. The foundation developed will be stronger, and you'll be less likely to develop bad habits, since most of the material is presented in a manner consistent with the python community (PEP).For example, the way variables and input functions are utilized between the two books are drastically different. In this book, user input and assignment is handled as follows:print('What's your name?')name = input()This is inefficient, and somewhat confusing, given that the alternative (as presented in Python Crash Course) is easier. In Python Crash Course, the same outcome is presented as follows:name = input("What is your name? ")The print statement asking for the user's name is excessive. If I'm trying to automate the boring stuff, I'm trying to trim the fat - not eat it.

As this book makes very clear from the start, you don’t have to be a programmer to using this book. I’m a professional software engineer that just needed to learn some python automation for work and personal projects. This book helped me get there but I can see how this book really was tailored toward those who are not experienced in programming as it breaks down each section into consumable bits that would seem a bit tedious to someone like me but would be perfectly helpful to someone without programming experience. I was able to skim the first few chapters that teach the language as I’m already versed in programming and was able to glean pythons syntax style pretty quickly. It’s a simple yet elegant language especially compared to others that I use daily. The part about this book that got me all excited was the web scraping section. As a web developer, I deal with web pages a lot and it would be nice to have some scripts that would auto fill forms and interact with the web pages for me as I’m making code changes on the day to day. It would really make my job—even as a developer—super easy, and it has.

Add this book to my small collection of Python books, and I am sure it will be a very good book, because this is not my first book for the same author (Al Sweigart), I have one more else, +the author provides all his books for free reading in the net, +there is an Udemy video course for this book by him.Hoping good reading, practicing, time with this book.

While this is indeed a great book to get started with python projects I won’t say it’s a great book for total beginners.The author often uses coding concepts at the beginning of the book that are not explained until a later chapter leaving some beginners feeling overwhelmed with his programming methods.I am not a beginner though so understanding the basics was easy for me. The projects are really good for beginners too. Though I would recommend starting with Python Crash Course 2nd edition which goes through the fundamentals in greater detail and is more organized in its teaching approach (it also comes with projects at the end of the fundamental chapters).Overall good book just wished it was better organized for the “beginner”

I just bought couple of weeks before. Almost half of the book I have finished. The author explains very well and You can actually use his example in python and test them. I recommend people who looking to work as a Cloud Architect / AWS architect etc.

The posted links to the examples at author(dot)com all seem to be pretty much dead, at , least as of the last time I checked several days ago. Big demerit for this.There is a lot of typing for the purpose of entering the code. It would be great, or it would be great if the web site was not DOA, to just be able to download some of those files. Or ship the book with a CD, which doesn’t seem to be a thing any more.Anyhow, it is OK so far, but there are issues with the execution.

I am working through this book and haven't finished it yet. I am a long term programmer having programmed for pay in Fortran for multiple jobs. I have been programming for over 30 years and learning an object oriented language requires a shift in perspective. So, I need little in algorithm development but details on the language features is important and capabilities to do the things that were simple in other languages is important to know how to do it in Python. This book is very complementary to the book Think Python, IMHO.I am working in Data Science and Machine Learning in particular and found that my ability to program in Python was lacking. So far this book has done a very good job familiarizing me with how to do certain critical things in Python. For Data Science having a section on web site data scraping is very important. I could just look how to do this. Also the data structures are much richer and varied. In Fortran you created any complexity in data structure yourself. I highly recommend this book for both new programmers and advanced programmers who need or want to learn Python.

Can’t say I enjoy reading technical book but I do it for learning. This one, is a gem. Funny, interesting relevant but not overwhelming. Good pace and got me started with Python better than googling.

I liked this book better than another book i bought " Python for kids." I haven't finished the whole book yet, but it just flows much better. This book was all i needed.

At first I thought these were a nice low value treat that didn’t break the bank. They don’t have too much smell so it was good to treat for potty breaks, but not for training a 9 week lab pup. One day while readying treats for my boy, one of them poked me. Looking closer, there was something hard poking out of the treat and I dug out what seems to be a piece of bone. This little bit was sharp so I don’t think it’s gristle. It makes me wonder how many have been hidden inside of treats that I haven’t caught. Needless to say, I will not be buying this again and if you have or if you do, make sure to inspect the treats closely.

Almost all the reviews are(1) - horrible product, with bones or plastic or fishhooks embeddedor(5) - the most fantastic treat ever created!My experience:When asked if he liked it, my dog gave a shrug and said “sure”.When asked to choose between Milk-Bone Trail Mix, he chose MBTM.Now the important bit. Seeing the recommended maximum number of treats on the pkg and Amazon page, possibly due to high calories but also maybe not, I grew suspicious.The second listed ingredient (after chicken) is coconut glycerol. Regardless of source, glycerol is not an ingredient found in appreciable amounts - though it is used as a sweetener in energy bars Since it is listed as second ingredient, there must be a lot.Glycerol is used in skin lotion and in small amounts in food. It used to be added to low quality wines, but is forbidden now. Glycerol is used by marathon runners to increase water retention.Glycerol is “generally regarded as safe” (GRAS). That means that specific safety studies on it have not been carried out, but no one has observed toxicity.But toxicity is affected by dose - which brings me back to the table on the package limiting how much should be given per day depending on dog’s weight. And the remarkably high content of glycerol.For me the risk outweighs the benefits. I will throw away what I bought.Based on reviews here, I searched for white plastic or bone and found none.I am a pharmacologist having worked in pharmaceutical industry. I tend to be over-cautious.Edit: Glycerol has more calories per gram than sugar has.

I was so excited to get these for my dog, but after giving my dog a few treats I noticed a white piece sticking out of one of the treats. When pulling it out I noticed it was a long white plastic piece (looked like the same material as the package as well). Sad to see that my dog loved them, but I can no longer give her any.

I like how amazon is asking me to rate the flavor, sorry, I don’t speak canine so I don’t know. I will say that if you have a highly motivated by food dog that this is worth your money. The quantity alone makes it worth it especially if you’re using positive reinforcement training and find yourself using up a 4oz to 6oz bag of expensive treats a day. These are easily breakable with minimal crumbling and you can feel safe providing a lot of low calorie treats for training sessions for your pup. I usually like more moist treats for my dog but these mean I can throw a bunch in my pocket for walks for the day and not worry about them drying up so much I end up with sawdust in my pocket.

I was looking for treats for my 4 senior dogs and bought these by accident. But, they LOVED these little treats. I’m having issues with 2 of my dogs to eat their food, so I will throw a few of these in the bowl and gets the job done. All my dogs have been through intensive training and we didn’t follow the treat system, so they are not treat driven. I hardly ever gave them treats while growing up, but they are older and old dogs deserve fun treats!

Our dog is picky! (As in he won't eat dog food and has to be hand fed his people food meals.) One thing he will eat happily (and on his own) is these treats! On a side note, he is getting older and at night we were noticing that it was hard for him to stand. However, once we started these treats, he was moving around much easier. We ran out and within a week, he was back to struggling at night. We ordered more and will never run out again!

I have Pembroke Welsh Corgis. Anyone who’s known a Corgi knows they’re chow hounds. That being said, my dogs definitely have so so treats and high value treats. Going from my dog’s opinions these definitely fall into the high value group. One thing that I’ve noticed is that although they can easily be swallowed whole, they both take the time to chew and enjoy them. I also, as an owner, like the fact that they are made in the USA. The cost is GREAT. They are approximately 1/3 or less, the cost of comparable treats. This is a real selling point for me as I’m currently training my new puppy and am going through a lot of treats. I only hope that Amazon doesn’t realize what a great product that they have and raise the price.

I was expecting a lot bc of reviews but my dogs left these in the floor ! Very rare ! Has only happened w cheap milk bone minis ( when all 3 hated something !) I was excited bc I lived the price and the size of these treats but all 3 of mine just hated them -sorry

I'm a non-programmer who played with BASIC back in the TRS-80 days. So, with my limited knowledge of computer logic, I found Python very easy to learn. I downloaded a Kindle sample to spend some time with Python to see if I wanted to go "all-in."What drove me nuts for the first few days was that the Kindle doesn't show the program layouts as clearly as the author's website. I was getting a lot of programming errors for having improper indentation. Viewing the code on the author's website straightened me out. It also convinced me to buy the paper version of the book, instead of the Kindle version. That's not a criticism of the author or his book, just the idiosyncrasies of the Kindle formatting.Content: A+ for non-programmers. Kindle layout: Leaves some clarity to be desired.

Add this book to my small collection of Python books, and I am sure it will be a very good book, because this is not my first book for the same author (Al Sweigart), I have one more else, +the author provides all his books for free reading in the net, +there is an Udemy video course for this book by him.Hoping good reading, practicing, time with this book.

I'm currently a college student not studying CS at the moment but needing to know a lot of the core key concepts with languages such as Python for data science and software engineering projects. I had a lot of experiences with online courses such as those on Udemy, Coursera, and Codecademy, but I felt like all of these were very lacking when it came to the support and resources behind these courses. As a college student trying to teach myself while observing my CS friends, I realized that the most important difference between taking college classes and self-studying is the community and on-demand support that books lack. Fortunately, a book like this has a whole community behind it and the support I have gotten is amazing! On top of not having to worry about grades for my classes, I can actually focus on learning Python without having to think about what assignments I need to allocate my efforts to. I found the supplementary Udemy course very helpful in verabilizing the key concepts of each chapter and this has helped me learn and focus on the right concepts.

Great content.

I picked this book up to begin to understand the language and see what might be possible.Immediately, I saw an opportunity to automate a function that costs me 2-3 hours a week. By incorporating Python scripting with Selenium and Excel, I can extract prior weeks Incident Metrics from 1 website, digest them within a spreadsheet, update a Confluence Page on another website, reach out to a third website to gather the Event Description for each Incident and compile that data back into the spreadsheet, so that I can begin my analysis. This is not only valuable to me, but I will be making it available to all Support Teams within our company, The cost savings will be over 150 Man Hours/Year for each group, possibly more.The book is both an Eye Opener and a Go-To Reference. Can't wait to see where it leads me from here!

I really appreciate this book. It is very helpful and well written. There is so much that one can do in Python these days with all the open source libraries one can simply bring in. This book does of good job demonstrating the utility of the language in automating jobs/tasks.

I have six books from this company now, three on Linux and three on Python. All are excellent additions to any library. The material they present continues to be easy to understand with every new book I buy from them. Coding is NOT easy, there's a lot of stuff to learn and tons that you've got to commit to memory. These books make the process enjoyable, and they use practical examples that make it a lot easier to understand things like the flow of logic within statements.Allow me to give a little context: I started with computers in the 80's when I was a kid. BASIC was all I had access to, fun, but not a great start. My first PC came along and I learned DOS, despite the mostly crappy documentation. Linux came along at the end of the 90's and, while it was a great OS back then, documentation held it back on the desktop. Best I could do was get it to boot, so Windows was the only choice for a couple decades.Flash forward to the present, and I've ditched Windows completely, picked up a couple books (I don't yet own a book on Linux NOT published by No Starch) and I do better now with Linux than I ever did with Windows. Linux documentation quality is also light-years beyond what it was in the 90's, too. I spent a month on Mint and went straight to Arch. Things have changed THAT much.

I bought the Bose SoundLink Revolve Bluetooth Speaker because I thought I ‘needed’ an acoustical and esthetic improvement over the forty-dollar black brick I used for streaming audio from my Android phone at different places in my home or when visiting friends. My primary stereo system is stationary. – I considered a few options and picked the Bose Resolve based on name recognition and looks – in silver grey, or “lux gray” in Bose terminology..I listen primarily to classical music, chamber and orchestra. However, with the Bose Revolve I have sampled other genres such as blue grass, rock, Latin, Jazz (vocal & small group and big band), acoustic guitar. I am impressed with the sound quality, the clarity – at pretty much the entire audible frequency spectrum (of an older guy). The other impressive feature to me is the relatively deep bass tones. And all this from a small down-firing single full-range driver/speaker assisted by “two passive bass radiators”. I am quoting from a review I found on the Internet.I use the single Revolve on my desk or another piece of furniture nearby at a distance between 4 to 9 feet. I feel setting it on a sturdy wooden plate such as a desk or counter top enhances the volume of the sound. The perceived sound quality is still very good, and loud enough, when placed about 36 to 50 feet away, provided there is no ambient noise. Placing it about two to three feet from a corner gives me the best sound.The speaker volume setting and other functions can be controlled from a Bose app via Bluetooth from a smartphone.Some write-ups and ads imply it produces a stereo or ‘surround’ sound. This is not correct. One speaker = mono. I am tempted to get another Revolve for true two-channel stereo performance. BUT I already have a good stereo system with wired speakers…I stream audio from different sources, mostly from a Samsung Galaxy (Android) phone (I keep older phones for streaming audio and video.) either directly to the Bose or paired with the Amazon second generation Echo Dot system.Battery performance has been excellent.Difference between Revolve and Revolve plus speakers:I was interested in the larger Revolve plus, thinking it had better speaker performance. I wanted to cut off the carrying cord for esthetic reasons.Bose Technical Support stated the performance of the Revolve (that comes without the carrying cord) equals that of the Revolve plus. Quote from a Bose email: “I would not suggest for you to remove that carrying handle as it will be considered as damaged cosmetic which will automatically void the warranty for the speaker. You can consider getting the Soundlink Revolve instead since there is actually no difference in the sound power and quality. One big difference between the two is the longevity of the playing time once fully charged aside from its size. . . .”I hope this little review is helpful.

Update 5/25:Looks like I was able to get the speaker working again. Called Bose support and they had me hold down the power button for 15 seconds and then pair my iPad again. This refresh corrected my issue. Happy we are back in business! Back up to 4 stars.Original review:I want to love this speaker. The shape takes the right amount of space. Sound is decent. I love that I can use it as a speakerphone to take my calls. My only problem is it just likes to randomly drop connection. I have to turn off/on the blue tooth trying to reconnect to get it working again. Very annoying. Since I have it connected to several devices, a call will come on, and then while on the call the device will blurt out it's connected to my ipad out of the blue. It will do it several times while I'm on the call. I'm gonna keep testing this, but the chance of returning to Amazon is very high. I also feel the score is unfairly inflated as 14 of the 17 5 star reviews are Vine reviews. Can Bose update the firmware on these devices?UPDATE 4/21I installed some updated drivers on my PC for my USB blutooth dongle and the connection seems better. Also disabling the auto disable feature is saving the iPad from getting dropped. Now I have encountered a new problem. The unit will be fully charged and within say an hour of use it will all of a sudden turn off. I turn it back on and then the power symbol is flashing red indicating neds to charge. I'll place it on the deck and then remove it from the dock and the green "medium to full charge symbol" appears. I must have a defective unit. I asked Amazon for another one. I really want this to workout as I like this speaker and it's ability to take calls. I also like moving it right next to me as I use a split keyboard and can get a little closer to the music and it sounds good with the speaker design. If the next one works and I continue to not have issues with taking calls, this will very easily be a 4 star review. For now it will remain 2.UPDATE 5/4I received the new speaker and problems were as bad previous speaker. I then saw there was a new firmware update and hoped ofr the best. Firmware update takes about 2 hours to do, but you can listen to music while it's doing the update. After the update the power issues appear to have been resolved. Connectivity to my PC for taking phone calls has also improved. It appears everything I discovered an issue with has been resolved. Keep in mind I have been rocking the new firmware for only 3 days, but it was working so well I felt I should bump up the score.Since I had the second speaker that I was going to return back to Amazon thinking the unit was defective, I decided to try out the 2 speaker feature. Works very well on my desk, and the sound it creates around you really pulls you into the music. The only thing I REALLY HATE is that you can't take any calls on the speaker when it's in this mode. If it did, I would probably have keep the second one. But if you want some stereo sound, this is a nice option at an expensive price point.Overall, I recommend this speaker after the firmware update as it now is doing everythig I want it do so far. I use it every day so if any other issues come up, I will be sure to update the review and score as needed.UPDATE 5/24Installed new firmware 1.1.8 and now I get pauses, snaps and crackles while connected to my iPad or S7 Edge. I have restarted devices, unpaired and then paired, but issue remains. The speaker is now garbage until this is fixed. Very irritated with Bose. Please release updated firmware to correct this issue ASAP!

I am a developer who has read many books and articles on Python (and other programming languages). This book is well written, refreshing, and HELPFUL! If you are learning python for the first time and have never written a program, are a business professional looking to “automate the boring stuff”, or an experienced Python programmer, there is literally something here for everyone. The projects are very simple to follow, the author even provides the source code for you if you don’t want to hand code it out (even though I definitely recommend coding along yourself to learn). I have purchased so many books and tools along my learning journey but this one is by far my absolute favorite and the cover is worn with proof of use and love. If your on the fence, this book is simply brilliant and having a copy at home is an essential and so valuable all I can say is DO IT!

I am following the UDEMY course that is attached to this book and wanted a physical copy of the book to go through when I had questions. Great well made product and is exactly what i was looking for!

A thorough and entertaining introduction to the world of computer programming.

Automate the Boring Stuff with Python, 2nd Edition: Practical Programming for Total Beginners
⭐ 4.7 💛 2758
paperback: $25.00
Buy the Book