DEV Community

Cover image for Free Books for Learning Python

Free Books for Learning Python

bowmanjd profile image Jonathan Bowman Updated on ・7 min read

Python tutorials abound. Sometimes, though, I want to feel like I am reading a consolidated and comprehensive volume of information about Python. In other words, a book.

How do I define "book"? A full-length multi-chapter resource that reads like a printed book. Very satisfying, especially if the quality-to-price ratio is pleasantly high.

The following good books are available to read online and, in some cases, to download. For free.

Please note that many of these free online books are also available in print, for a cost. Follow the links to find ways of purchasing print books that support the authors.

Downloadable Official Python Docs

Python logo

While I wouldn't normally classify the Python docs as a book, the downloadable version looks and reads like one. It is available in HTML, PDF, and even plain text and ePub formats.

Audience: Anyone, from beginner to veteran, will benefit from having the Python docs close at hand.

Strengths: Comprehensive and detailed, and also includes tutorials and examples.

Topics: All of them! Not surprisingly, though, rarely are 3rd party libraries and tools mentioned.

Automate the Boring Stuff with Python

Automate the Boring Stuff with Python

Hint: after clicking on the link, scroll down until you find the table of contents!

This is one of several excellent books by Al Sweigart, and has long served as an introduction for many newcomers to Python. That said, the practical nature of this resource serves any student of the language, old or new, and encourages all of us to think about repetitive tasks we might automate to make life more enjoyable.

Audience: Those new to Python, data jockeys of all sorts, system administrators, and anyone looking for creative solutions for everyday tasks.

Strengths: Practical, approachable. Did I mention practical?

Topics: Python basics, CSV, PDF, Excel, web scraping, images, email, debugging, and more.

The Hitchhiker's Guide to Python

The Hitchhiker's Guide to Python

This creative, readable, and constantly updating guide comes from Kenneth Reitz, who also authored requests, one of the most popular HTTP libraries for Python. While the guide introduces Python and the standard library, it is notable for the many third party libraries and tools described.

Audience: Those new to Python, as well as those brushing up and interested in exploring the breadth of use cases and solid 3rd party tools and libraries for Python

Strengths: Practical, enjoyable, broad.

Topics: Python basics, installation, virtual environments, project structure, coding style, documentation, packaging, GUI development, command line interface development, and much more.

Think Python

Think Python 2nd edition

Think Python: How to Think Like a Computer Scientist, by Allen B. Downey, provides a wonderful hybrid approach of a practical introduction to Python combined with computer science principles. As someone who does not have a computer science degree, I find that this book fills in some gaps in my knowledge, while still being approachable and avoiding unnecessary academic trivia. The writing is personal and informative.

Audience: Pythonistas learning computer science, computer science students learning Python, anyone who wants to learn Python and dig a bit into computer science.

Strengths: Readable, thorough, brainy

Topics: Python syntax, structure, and computer science paradigms

A Byte of Python

A Byte of Python

A Byte of Python by Swaroop C H is a sweet, elegant, understandable introduction to Python. Easy yet rich. It is the haiku of Python texts. The book has also been translated into a variety of languages.

Audience: Those new to Python and those needing a refresher. Or if you simply enjoy a kind and thoughtful book.

Strengths: Easy to understand, gentle, thorough

Topics: Python fundamentals and problem solving

Architecture Patterns with Python (Cosmic Python)

Architecture Patterns with Python: Enabling Test-Driven Development, Domain-Driven Design, and Event-Driven Microservices

This book's authors Harry J.W. Percival and Bob Gregory are eager to engage problems posed by enterprise-grade software complexity. They believe the Python community is ripe for the facing of such issues, and they are convincing. This book, then, focuses on software architecture and testing, including a methodology titled "Domain Driven Design." The authors provide a blend of practical problem-solving and consideration of applicable design patterns.

Audience: Intermediate to advanced Python developers who may not be familiar with Domain Driven Design

Strengths: Explains deep concepts in thorough but understandable ways, introduces advanced design concepts

Topics: Test Drive Development, Domain Driven Design, microservices

Problem Solving with Algorithms and Data Structures using Python

Problem Solving with Algorithms and Data Structures using Python

Another great book that introduces Python and computer science concepts, Problem Solving with Algorithms and Data Structures using Python is unique in that it is interactive. Bradley N. Miller and David L. Ranum have provided both text and code examples that are editable and runnable. As you might be able to tell from the title, there is a strong emphasis on how Python manages data. Readers will take a deep dive into data types and the storing and structuring of data while using Python. Algorithms get attention as well. As noted before, I was not a Computer Science major, and this book helps me understand, finally, what people mean when they talk about a "bubble sort."

Audience: Those new to Python and computer science, or those with some familiarity with either, hoping to improve.

Strengths: Classic concepts, topically diverse, smart.

Topics: Data structures, algorithms, fundamentals of Python

Python Data Science Handbook

Python Data Science Handbook

I learned Python for system administration and web development. Many, many Python users, however, grew into Python because of the robust Python ecosystem around data science and machine learning. If you are like me, and data science is an alien planet, this book will help. Or, on the other hand, if you are dabbling in data science, and want to know how Python can help you dig in, it is a good fit for that, too. Jake VanderPlas does an excellent job getting us hands on and familiar.

Audience: Those already familiar with Python and/or programming, hoping to learn tools for data science

Strengths: nerdy and practical

Topics: Numpy, Pandas, Matplotlib, machine learning, and other hip subject matter

How To Code in Python

How To Code in Python

If How to Code in Python feels remarkably "digestable" to you, that may be because it was written in bite-sized pieces. Originally a blog/tutorial series, Digital Ocean provides this series of introductory articles in downloadable book form as well, both as a PDF and even an ePub.

Audience: Those new to Python, as well as those brushing up.

Strengths: Practical, digestable, pleasant

Topics: Python basics, installation, debugging logging, data types, hints and tips.

Python for You and Me

Python for You and Me

Do you appreciate "physical computing" (Arduino, Raspberry Pi, LEDs, and the like), or want to dive into web development right away? If not, Kushal Das's book is still a readable and succinct introduction to Python you may enjoy. But if you do appreciate circuit boards and similarly hands-on activities, then it has even greater value. It offers experience with such tools as CircuitPython, Flask and Pypercard, and dwells on other topics I do not usually see included in other books.

Audience: Those new to Python

Strengths: step-by-step pace, contains variety

Topics: Python fundamentals, editors, PEP8, testings, NeoPixels, command line interfaces.

Intermediate Python

Intermediate Python

Seeking to fill the gap between introductory documentation and advanced principles and practice, Yasoob Khalid wrote the appropriately named Intermediate Python. I love his inclusion of functional paradigms, comprehensions/generators, and even a clever chapter on "one-liners." Seeing his chapter on ternary operators initially made me cringe, as Python doesn't have them. However, upon further reading, I rather enjoyed the patterns he demonstrated there, and felt that I was learning to think creatively.

Audience: Intermediate Python developers. Surprising, right?

Strengths: advanced yet understandable concepts, unique among Python programming books

Topics: Debugging, exception handling, functional programming, mutable/immutable types, and much more.

Functional Programming in Python

Functional Programming in Python

Python favors object-oriented programming, right? If you want functional go use Haskell or Elixir or one of many others.

Well, not necessarily. Python is flexible enough to accommodate functional programming and paradigms, to some degree. O'Reilly makes David Merz's book available as a freely downloadable PDF. Take a look if you want to get your feet wet with functional programming.

Audience: Those somewhat familiar with Python who are interested in functional programming.

Strengths: Thoughtful and fresh. And functional.

Topics: Functional programming.

Other free books?

Do you have other free book suggestions? Please post a comment!


Editor guide
py_talk profile image

maybe not for learning, but to keep things

bowmanjd profile image
Jonathan Bowman Author

Thanks for the recommendation! I am curious: what qualities does that book have that cause you to recommend it to others? Why do you like it?

py_talk profile image

it's not a book. rather a notebook. for me it's "nicer" version of documentation for python AND many packages in one place. I like to search some utilities in PythonBook first.