Dev

12 Best Python Programming Books for 2026

This post contains affiliate links. If you buy through them, we may earn a small commission at no extra cost to you. Learn more.

Python 3.10 reached end of life on October 1, 2026, and three of the best Python books below were written for it. Amazon also still sells the 2013 edition of Learning Python, which covers Python 2, right next to the 2025 rewrite that drops it. Buy the wrong edition and you learn habits the language and the authors themselves have since moved past, so the book has to match the Python you’ll actually run.

Original content from computingforgeeks.com - post 74100

These twelve Python books cover the whole path, from your first script to fast, typed, tested code. You get three beginner books, a full reference, the books that teach idiomatic Python, and picks for testing, architecture, data, machine learning and performance. Each section names the Python version the book targets, because that ages a Python book faster than anything else. Editions, page counts and prices come from Amazon’s live catalog, and contents from each publisher’s or author’s page (Amazon’s descriptions where a publisher page was blocked), and the list was reviewed again in November 2026.

Pick a Python book by your goal

You don’t need twelve books. Most people need one book to learn the language and one that makes them write it well, so start from what you want Python for:

Before you open any of them, install a current Python on Ubuntu or on Rocky Linux or AlmaLinux, so your interpreter is at least as new as the book. An old system Python is a common reason a book’s examples fail on page 40.

How these books were chosen

Amazon returns hundreds of Python titles for any search, and a lot of them are short self-published books that repackage the official tutorial. We filtered from the publishers’ own catalogs instead and kept a book only if it cleared three bars:

  • an established technical publisher (No Starch, O’Reilly, Addison-Wesley, Pragmatic Bookshelf)
  • a current edition that teaches Python 3 as it is written today
  • buyable new right now, not only as a used copy

We did not read all twelve cover to cover, so treat this as a buyer’s guide rather than twelve full reviews. Each book was judged on its table of contents, its publisher’s description, the author’s companion site and how current the material is. Edition, binding, page count, price and stock came from Amazon’s product API on the day we wrote this. Star ratings are not quoted, because that API does not return them and we will not print a number we cannot check.

Compare the Python books side by side

Read the “Written for” column first. A 2021 book is still useful, but it cannot teach features that arrived after it went to print, so pair it with something newer. Prices are what Amazon charged when we checked and they move often:

BookAuthor / PublisherPublishedPagesWritten forPrice
Python Crash Course, 3rd ed.Eric Matthes / No StarchJan 2023552Python 3, 2023 tooling~$21
Automate the Boring Stuff, 3rd ed.Al Sweigart / No StarchMay 2025672Python 3, 2025 libraries~$22
Think Python, 3rd ed.Allen B. Downey / O’ReillyJul 2024325Python 3 in Jupyter~$35
Learning Python, 6th ed.Mark Lutz / O’ReillyFeb 20251,169Python 3.12+~$54
Fluent Python, 2nd ed.Luciano Ramalho / O’ReillyMay 20221,012Python 3.10~$43
Effective Python, 3rd ed.Brett Slatkin / Addison-WesleyNov 2024672Python 3.13~$43 (Kindle)
Robust PythonPatrick Viafore / O’ReillyAug 2021378Typing as of 2021~$33
Python Testing with pytest, 2nd ed.Brian Okken / PragmaticMar 2022274Python 3.10, pytest 7~$30
Architecture Patterns with PythonPercival, Gregory / O’ReillyApr 2020304Patterns, version-light~$37
Python for Data Analysis, 3rd ed.Wes McKinney / O’ReillySep 2022579Python 3.10, pandas 2.0 (online)~$44
Hands-On ML with Scikit-Learn and PyTorchAurélien Géron / O’ReillyDec 2025875Scikit-Learn, PyTorch~$78
High Performance Python, 3rd ed.Gorelick, Ozsvald / O’ReillyJun 2025521NumPy, Polars, Cython~$45

Python 3.15 came out on October 9, 2026, and every book on this list predates it. That matters less than it sounds: the newest picks cover Python 3.12 and 3.13, and nearly everything they teach still runs on the current release. The exceptions are removed APIs and a few changed defaults: Python 3.15 made UTF-8 the default encoding, and on Linux Python 3.14 switched multiprocessing and ProcessPoolExecutor to the forkserver start method, which can change how the process-pool examples in Fluent Python and High Performance Python behave.

1. Python Crash Course

Buy this one if you’ve never programmed and you learn by building things. No Starch bills it as the world’s best-selling Python guide, and the 2023 third edition is the one to get.

Python Crash Course 3rd Edition by Eric Matthes book cover
Python Crash Course, 3rd Edition by Eric Matthes. Image: No Starch Press.

Part I runs through the language in eleven chapters, from variables and lists to classes, files, exceptions and a chapter on testing your code with pytest. Part II spends the other half of the book on three projects:

  • a Space Invaders style arcade game in Pygame
  • data visualizations with Matplotlib and Plotly, fed from files and web APIs
  • a Django web app with user accounts that you style and deploy online

Matthes switched the third edition’s editor to VS Code and its file handling to pathlib, which is how current Python code reads files.

It moves at a beginner’s pace, so a developer coming from Java or Go will find the first eleven chapters slow and should start with Fluent Python instead. Amazon listed it at around $21 (list $49.99) when we checked. Check the current price on Amazon.

2. Automate the Boring Stuff with Python

Pick this over Crash Course if your goal is to stop doing repetitive work by hand. Al Sweigart’s third edition came out in May 2025, and it’s written for people who will never call themselves programmers.

Automate the Boring Stuff with Python 3rd Edition by Al Sweigart book cover
Automate the Boring Stuff with Python, 3rd Edition by Al Sweigart. Image: No Starch Press.

The first eleven chapters cover the basics, from flow control and functions to regular expressions and organizing files, then the book turns into a toolbox. You get chapters on web scraping, Excel and Google Sheets, PDFs and Word files, CSV, JSON and XML, scheduling tasks, sending email and push notifications, and controlling the keyboard and mouse. The third edition added chapters on command line programs, SQLite databases, reading text out of images, and text-to-speech and speech recognition. For a sysadmin that SQLite chapter and the command line chapter are the useful additions, because they turn one-off scripts into tools other people can run.

You can read the whole book free online under a Creative Commons license at automatetheboringstuff.com, and No Starch sells a companion workbook if you want more exercises. It stops at scripts, though. There’s a debugging chapter but no chapter on testing, so you’ll need a second book once your scripts become software that other people depend on.

Amazon listed it at around $22 (list $59.99) when we checked. Check the current price on Amazon.

3. Think Python

This is the beginner book for people who want to understand programming, not just finish a project. The subtitle is How to Think Like a Computer Scientist, and Allen Downey wrote it for people who have never programmed or have tried and struggled.

Think Python 3rd Edition by Allen B. Downey book cover
Think Python, 3rd Edition by Allen B. Downey. Image: O’Reilly Media.

Downey rewrote the July 2024 third edition entirely as Jupyter notebooks, so you read the text, run the code and do the exercises in one place. Every chapter runs on Google Colab, which means a beginner does not install anything to get started. Its 19 chapters cover functions, recursion, iteration, strings and regular expressions, lists, dictionaries and tuples, files and databases, then classes and inheritance. Each chapter now ends with suggestions for using ChatGPT or Colab AI to get help with the exercises, which is a sensible way to bring an assistant into learning without letting it do the work. If you’d rather run the notebooks on your own machine, set up JupyterLab locally first.

It’s short at 325 pages and builds no real projects, so readers who need to automate something this week should take Automate the Boring Stuff instead. The full text is free on the author’s site; the paperback was around $35 (list $48.99) on Amazon when we checked. Check the current price on Amazon.

4. Learning Python

Mark Lutz’s book is the complete reference to the core language, and the sixth edition finally drops Python 2 entirely.

Learning Python 6th Edition by Mark Lutz book cover
Learning Python, 6th Edition by Mark Lutz. Image: O’Reilly Media.

O’Reilly released this edition on February 25, 2025, and it is current with Python 3.12 and later. New material covers f-strings, assignment expressions, match statements, type hinting, async coroutines, exception groups and positional-only arguments. The rewrite also cut the book hard: the print edition is 1,169 pages, about 29% shorter than the fifth edition, and two advanced chapters moved online as free PDFs. Lutz also cut the Monty Python references and the personal anecdotes, and gave more attention to non-Windows platforms.

Use it as the book you look things up in rather than the one you learn from, because it covers every corner of the core language and deliberately stays away from third-party libraries. If you want to build something by the weekend, start with a beginner pick and keep this one for the questions those books don’t answer.

Amazon listed it at around $54 (list $79.99) when we checked. Check the current price on Amazon.

5. Fluent Python

Read Fluent Python once you can write Python that works and want to write Python that reads like Python. It’s the book experienced developers coming from other languages need most.

Fluent Python 2nd Edition by Luciano Ramalho book cover
Fluent Python, 2nd Edition by Luciano Ramalho. Image: O’Reilly Media.

Luciano Ramalho splits its 1,012 pages into five parts that work like short books:

  • data structures: sequences, dicts, sets, Unicode and data classes
  • functions as objects, with type hints
  • object-oriented idioms: protocols, interfaces and operator overloading
  • control flow: generators, context managers, async/await, thread and process pools
  • metaprogramming: properties, descriptors and class decorators

The second edition added new chapters, including data class builders and type hints in functions, and its cover says it covers Python 3.10.

The flip side is that Python 3.10 reached end of life in October 2026, and the book does not teach 3.11 and later features. It also assumes you already program; a beginner will drown in the first part.

When we checked, Amazon itself wasn’t selling the paperback: a third-party seller listed it new at around $43 (list $79.99) with a later ship date, so compare offers before you buy. Check the current price on Amazon.

6. Effective Python

Effective Python is the one to keep open while you code, because every item is a short, standalone rule you can apply in an afternoon.

Effective Python 3rd Edition by Brett Slatkin book cover
Effective Python: 125 Specific Ways to Write Better Python, 3rd Edition by Brett Slatkin. Image: Pearson Addison-Wesley.

Brett Slatkin’s third edition, published in November 2024, covers Python up to 3.13 and grew from 90 items to 125. It adds two new chapters on robustness and performance and covers writing C extension modules and calling native shared libraries. The items are specific: prefer dataclasses for lightweight classes, use match for destructuring only when if is not enough, never modify a container while iterating over it. Slatkin says some of his advice changed completely from the second edition as Python best practice moved on, which is a good reason not to buy the 2019 edition used.

Amazon had the print edition out of stock when we checked, so the links here go to the Kindle edition. InformIT sells the print book directly. It is not a tutorial, so a reader who does not know what a generator or a decorator is will get more from Fluent Python first.

The Kindle edition was around $43 when we checked. Check the current price on Amazon.

7. Robust Python

Robust Python is about one problem: keeping a Python codebase understandable once it outgrows the person who wrote it.

Robust Python by Patrick Viafore book cover
Robust Python: Write Clean and Maintainable Code by Patrick Viafore. Image: O’Reilly Media.

Patrick Viafore’s answer is Python’s type system used fully. He covers why types matter and how choosing a class, a dictionary or an enum tells the next reader what you meant. Later parts show how to make code extensible without bloating it, and how linters and tests form a safety net around the whole thing. It’s the right book for the developer whose team just turned on a type checker and who wants to understand what it’s asking for.

It came out in August 2021, so it predates the type parameter syntax added in Python 3.12 and other typing changes since. The ideas hold up, but check the current typing documentation when the syntax in the book looks dated. Stock was limited when we checked, at around $33 (list $55.99). Check the current price on Amazon.

8. Python Testing with pytest

If you test Python code, you use pytest, and Brian Okken’s book is the clearest way to learn it properly.

Python Testing with pytest 2nd Edition by Brian Okken book cover
Python Testing with pytest, Second Edition by Brian Okken. Image: The Pragmatic Bookshelf.

Okken builds a test suite against a small database application, so you learn fixtures, parametrization, markers and plugins on code that looks like real work. Later chapters cover configuration files, test strategy, coverage, mocking, tox, continuous integration and running tests in parallel, and the final chapter goes into advanced parametrization. Okken also explains how to run existing unittest tests under pytest, which is what most teams with an older codebase need first.

Its examples were written for Python 3.10 and pytest 7, and pytest has since reached 9.x, so a few plugin and configuration details have moved. The fixture model the book is built around is still how pytest works, which is why it’s still the one to read. Stock was limited on Amazon when we checked, at around $30 (list $45.95). Check the current price on Amazon.

9. Architecture Patterns with Python

This is the book for the point where your Flask or Django app has grown a tangle of business logic and you need a way to structure it. If you still have to build that app first, our guide to Django, Flask and FastAPI books covers the framework side.

Architecture Patterns with Python by Harry Percival and Bob Gregory book cover
Architecture Patterns with Python by Harry J.W. Percival and Bob Gregory. Image: O’Reilly Media.

Harry Percival and Bob Gregory walk through test-driven development, domain-driven design and event-driven microservices in Python. Part 1 builds domain modeling, the repository pattern, a Flask API with a service layer, the unit of work pattern and aggregates; Part 2 adds events and a message bus, commands and handlers, CQRS and dependency injection. Everything grows on one example application from the authors’ work at MADE.com, so you see each pattern solve a problem the previous chapter created. There’s an appendix on applying the repository and unit of work patterns in Django, and the book pairs well with the general titles in our main list of language-agnostic programming books.

It was published in April 2020 and there’s no second edition, but patterns age slowly and the Python version matters little here. The authors publish the full text free at cosmicpython.com under a Creative Commons license, so you can read a chapter before deciding. It’s overkill for scripts and small apps, where these layers add more code than they save. Stock was limited when we checked, at around $37 (list $65.99). Check the current price on Amazon.

10. Python for Data Analysis

Wes McKinney created pandas, and this is still the book that teaches it best.

Python for Data Analysis 3rd Edition by Wes McKinney book cover
Python for Data Analysis, 3rd Edition by Wes McKinney. Image: O’Reilly Media.

McKinney teaches NumPy and pandas inside IPython and Jupyter. Its chapters move from loading data in different file formats to cleaning, joining and reshaping it, then plotting, group operations and time series, with an introduction to modeling libraries at the end. It was published in 2022 for Python 3.10, and the free open-access edition at wesmckinney.com/book has since been updated for pandas 2.0.0, so the online text is the more current one if a print example misbehaves.

It’s a pandas book first and foremost. If you want to train models rather than handle data, Géron’s book is the next step, and our wider machine learning book guide covers the theory side. Amazon listed it at around $44 (list $79.99) when we checked. Check the current price on Amazon.

11. Hands-On Machine Learning with Scikit-Learn and PyTorch

Aurélien Géron’s machine learning book switched from TensorFlow to PyTorch in this December 2025 release, and that’s the edition to buy.

Hands-On Machine Learning with Scikit-Learn and PyTorch by Aurelien Geron book cover
Hands-On Machine Learning with Scikit-Learn and PyTorch by Aurélien Géron. Image: O’Reilly Media.

It starts with the basics (overfitting, hyperparameter tuning, an end-to-end project in Scikit-Learn) and unsupervised learning like clustering and anomaly detection. Then it moves to PyTorch for deep learning: transformers, diffusion models, fine-tuning pretrained models including LLMs, and reinforcement learning agents, with the Hugging Face ecosystem throughout. Make sure the cover says PyTorch, because Amazon still sells the 2022 third edition built on Keras and TensorFlow, and the two look alike at a glance.

At 875 pages and around $78 (list $89.99) when we checked, it cost more than any other book on this list that day. You’ll want to be comfortable with Python and some NumPy before you start, so it is not a first book. Check the current price on Amazon.

12. High Performance Python

Read this when your Python code is correct but too slow, and you need to know why before you rewrite it.

High Performance Python 3rd Edition by Micha Gorelick and Ian Ozsvald book cover
High Performance Python, 3rd Edition by Micha Gorelick and Ian Ozsvald. Image: O’Reilly Media.

Micha Gorelick and Ian Ozsvald’s June 2025 third edition starts with profiling CPU time and memory, then works through choosing data structures, NumPy for matrix and vector work, and processing DataFrames quickly with pandas, Dask and Polars. Later chapters cover Cython and compiling Python to machine code, GPU computation, concurrent I/O, and moving multiprocessing code onto clusters, with war stories from companies running GenAI data extraction and production machine learning. The Polars and Dask material matters most to anyone who has watched a pandas job run out of RAM.

Most slow code does not need any of this. It needs a better data structure or algorithm, and profiling tells you which, so read the profiling chapters before reaching for Cython. Stock was limited when we checked, at around $45 (list $65.99). Check the current price on Amazon.

Check which Python version a book teaches

The version a book was written for is its real spec. A new Python release ships every October, and older books keep teaching patterns the language has since replaced, so check a few things before you buy any Python book:

  • the publication year and edition number on the cover you are buying
  • the Python version named in the preface or on the publisher’s page
  • whether it still mentions Python 2 at all
  • whether a free online edition exists

Free editions are common in Python publishing, and they’re legitimate. Automate the Boring Stuff, Think Python, Python for Data Analysis and Architecture Patterns with Python are all readable online by their authors’ choice, and Learning Python moved two chapters online. Reading a chapter online is the best test of whether a book’s style works for you, and buying the print copy afterwards is how the authors get paid. Watch for older editions, new or used, of Effective Python and Fluent Python in particular, because they are still widely listed. Slatkin says some of his advice in the earlier Effective Python editions has changed completely.

Books also pair well with an assistant now. If you are learning with Copilot or Claude Code open next to you, our guide to books on coding with AI agents covers how to use one without skipping the part where you learn.

Which two books to buy first

Two books cover most people. The first teaches you the language, the second teaches you to write it the way experienced Python developers do:

  • Total beginner who likes projects: Python Crash Course, then Fluent Python
  • Sysadmin or DevOps engineer: Automate the Boring Stuff, then Python Testing with pytest
  • Experienced developer from another language: Fluent Python, then Effective Python
  • Moving into data work: Python Crash Course, then Python for Data Analysis
  • Moving into machine learning: Python for Data Analysis, then Hands-On Machine Learning

Whichever pair you choose, install a current Python 3 first and run every example yourself. On Fedora, the Fedora development setup gets Python and its tooling in place in a few minutes. A book you type along with teaches you more than two you read on the couch.

Keep reading

Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) Ubuntu Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 Security UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 How to Upgrade Fedora 44 to Fedora 45 (GUI, CLI and Rollback) Fedora How to Upgrade Fedora 44 to Fedora 45 (GUI, CLI and Rollback) Upgrade a Single Package on Ubuntu / Debian with apt Debian Upgrade a Single Package on Ubuntu / Debian with apt CapRover Docker Install on Debian 13: Deploy Your First App Containers CapRover Docker Install on Debian 13: Deploy Your First App Install NVIDIA Drivers on Fedora 45/44 (Secure Boot, Legacy GPUs) Fedora Install NVIDIA Drivers on Fedora 45/44 (Secure Boot, Legacy GPUs)

Leave a Comment

Press ESC to close