Top 22 Python Books for Beginners and Advanced Coders
In this article, we’ll look at the best books for learning Python — catering for the absolute beginner level right through to the highest level of proficiency, as well different fields and learning angles.
Get ready, as this will be a deep dive! 🤿
- What Is Python?
- How to Choose the Best Python Books
- Best Python Books for Beginners
- Python Programming: A Beginner’s Guide to Learn Python in 7 Days
- Learn Python in One Day and Learn It Well: Python for Beginners with Hands-on Project
- Python Pocket Reference: Python In Your Pocket
- Learning Python: Powerful Object-Oriented Programming
- Fluent Python: Clear, Concise, and Effective Programming
- Python for Beginners: A Crash Course Guide to Learn Python in 1 Week
- Python Crash Course: A Hands-On, Project-Based Introduction to Programming
- Automate the Boring Stuff with Python: Practical Programming for Total Beginners
- Best Python Books for Learning Computer Science
- Best Specialized Python Books
- Python for Everybody: Exploring Data in Python 3
- Python for Data Analysis: Data Wrangling with pandas, NumPy, and IPython
- Invent Your Own Computer Games with Python
- Introduction to Machine Learning with Python: A Guide for Data Scientists
- Python for Excel: A Modern Environment for Automation and Data Analysis
- Python for Finance: Mastering Data-Driven Finance
- Best Python Books for Hackers
- One-size-fits-all Python Books
What Is Python?
Python is a programming language that you can use for pretty much anything. It’s fun, well thought out, elegant by design, widely adopted, and comparatively easy to learn.
And seriously, none of that is an understatement. Python really goes all the way when it comes to general-purpose programming:
- web development
- machine learning and artificial intelligence
- data science and data analysis
- software testing
- (to some degree) game development and microcontrollers
If you want to know more about Python, check out What Is Python and What Is It Used For?
How to Choose the Best Python Books
While Python itself is easy to learn, there is a lot of ground to cover. That’s because there’s a lot you can do with it! Not surprisingly, there are many great books.
Here are some things to consider when picking a Python book:
- your current programming skills
- the field you’re interested in
- your learning approach (is it academic, rather practical, or “hacker” style?)
With that in mind, let’s get acquainted with some titles!
Please note that as an Amazon Associate, SitePoint will earn commisions from qualifying purchases made through links in this article.
Best Python Books for Beginners
The logical place to start is with books for absolute beginners, so here are some of our favorites.
Python Programming: A Beginner’s Guide to Learn Python in 7 Days
- Author: Ramsey Hamilton
- Publishing: independent (June 14, 2016)
- Paperback: 90 pages
- Ranking on Amazon: 4.4/5 (5,822 ratings)
Python Programming is a very straightforward and concise book, being only 90 pages long! It’s written in simple language, and is a great choice for the absolute beginner. It covers the basics of Python and its data structures, and also touches on topics such as functions, classes, modules, and exceptions.
There are a few quality issues reported in the eBook, such as typos and poor formatting, which can be a bit annoying for the reader. That said, it still has nearly 6,000 ratings on Amazon, so if you’re after a quick, short guide, and a fairly inexpensive book, it may well be worth checking out.
Learn Python in One Day and Learn It Well: Python for Beginners with Hands-on Project
- Author: Jamie Chan
- Publishing: second edition (May 4, 2017)
- Paperback: 174 pages
- Ranking on Amazon: 4.5/5 (1,547 ratings)
If you prefer to learn with hands-on projects, prolific author Jamie Chan’s Learn Python in One Day and Learn It Well is probably a good fit for you.
It’s a fairly compact book that covers the foundations of the language in the first part and then moves on to more advanced topics and a complete project.
Python Pocket Reference: Python In Your Pocket
- Author: Mark Lutz
- Publishing: fifth edition (March 11, 2014)
- Paperback: 262 pages
- Ranking on Amazon: 4.5/5 (848 ratings)
Mark Lutz (blog) is one of the earliest Python authors, and Python Pocket Reference is a key item in his prolific lists of works and is in its fifth edition and counting.
Aimed mainly at reference rather than learning, this book covers Python 3.4 and 2.7, and even nearly ten years after first being published it’s still an invaluable reference for all Python programmers. It’s part of O’Reilly’s Pocket Reference series, composed of 34 books on a variety of topics.
It covers the language syntax and standard libraries, including:
- built-in functions and exceptions
- data types and structures
- statements and syntax
- functions and arguments
- classes and objects
- modules and packages
Learning Python: Powerful Object-Oriented Programming
- Author: Mark Lutz
- Publishing: fifth edition (July 30, 2013)
- Paperback: 1,643 pages
- Ranking on Amazon: 4.5/5 (1,729 ratings)
With Learning Python, Mark Lutz has achieved another fifth-edition book. But unlike Python Pocket Reference, Learning Python is a full on deep dive.
This book is part of the Learning Python series (7 books). In over 1,600 pages, it covers:
- types and operations
- functions and generators
- modules and packages
- classes and OOP
- exceptions and tools
- other advanced topics
Fluent Python: Clear, Concise, and Effective Programming
- Author: Luciano Ramalho
- Publishing: first edition (September 15, 2015)
- Paperback: 790 pages
- Ranking on Amazon: 4.7/5 (684 ratings)
Among the best-ranked Python books, Fluent Python (repo) is also part of the Learning Python series.
However, in Fluent Python, author Luciano Ramalho (GitHub) gets into the so-called “Pythonic way”, illustrating efficient and elegant code that exploits Python’s unique capabilities and style.
If you’re looking for a beginner book that goes the extra mile and pushes you a bit further forward, this might be what you’re looking for.
Python for Beginners: A Crash Course Guide to Learn Python in 1 Week
- Author: Timothy C. Needham
- Publishing: independent (September 21, 2017)
- Paperback: 135 pages
- Ranking on Amazon: 4.3/5 (3,152 ratings)
Python for Beginners is pretty straightforward and it covers all the basics in a “crash course” format.
And while it might not be the most comprehensive book on Python, with over 3,000 ratings on Amazon you can’t deny it’s quite a popular one.
Python Crash Course: A Hands-On, Project-Based Introduction to Programming
- Author: Eric Matthes
- Publishing: second edition (May 3, 2019)
- Paperback: 544 pages
- Ranking on Amazon: 4.7/5 (7,807 ratings)
This is the most popular book of our selection, the one with the highest ratings — and boy, you’ve got to love that cover!
Written by Eric Matthes (GitHub, old blog), author of several Python books, Python Crash Course (repo) is still today the #1 best seller in Python programming on Amazon. With over 1,000,000 copies sold, this is arguably the most popular Python book of all time.
Python Crash Course teaches programming through three projects that really show how multi-purpose Python can be:
- a 2D Space Invaders-style arcade game
- responsive data visualizations
- a customized web app
Automate the Boring Stuff with Python: Practical Programming for Total Beginners
- Author: Al Sweigart
- Publishing: second edition (November 12, 2019)
- Paperback: 592 pages
- Ranking on Amazon: 4.7/5 (2,689 ratings)
With 10 books published and hundreds of repos on GitHub, Al Sweigart (blog, GitHub) is a prolific Pythonist author and coder — which, believe it or not, is not that usual, as many authors don’t code all that much!
Automate the Boring Stuff with Python is among the best-ranked Python books, and it has a companion website and a full course on Udemy, both maintained by the author.
Check out the 15-video series below, in which Al covers the entire book. It’s fantastic!
Best Python Books for Learning Computer Science
Let’s now focus in on Python books that teach you how to use Python in the field of computer science.
Learn Python 3 the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code
- Author: Zed Shaw
- Publishing: first edition (June 27, 2017)
- Paperback: 320 pages
- Ranking on Amazon: 4.4/5 (936 ratings)
We’re entering more experienced territory now. If you already know some Python and want to go deeper, Zed Shaw‘s (GitHub) Learn Python the Hard Way (repo) will take you further through a series of 52 programming exercises.
And if you like the author’s approach, this is part of the five-book series Zed Shaw’s Hard Way, which also includes the followup Learn More Python 3 the Hard Way: The Next Step for New Python Programmers.
Coding for Kids: Python: Learn to Code with 50 Awesome Games and Activities
- Author: Adrienne Tacke
- Publishing: first edition (March 19, 2019)
- Paperback: 232 pages
- Ranking on Amazon: 4.6/5 (1,517 ratings)
Now for something fun! Python is an excellent language for kids, as it’s relatively simple and easy to learn, yet powerful enough to allow them to create projects and games. Coding for Kids Python will help your kid get started.
Written by Las Vegas–based, Filipina software engineer Adrienne Tacke (blog, GitHub), Coding for Kids also helpfully comes in a spiral-bound edition. 😀
Python Programming: An Introduction to Computer Science
- Author: John Zelle
- Publishing: third edition (August 8, 2016)
- Paperback: 552 pages
- Ranking on Amazon: 4.6/5 (387 ratings)
For a more formal approach to the subject, John Zelle, Ph.D has published a book that’s used in many universities as the main textbook for a Computer Science course based on Python.
Python Programming is a fairly complete book, and is a fine starting point for those who are new to the world of programming and computer science.
Think Python: How to Think Like a Computer Scientist
- Author: Allen Downey
- Publishing: second edition (January 26, 2016)
- Paperback: 289 pages
- Ranking on Amazon: 4.7/5 (515 ratings)
Written by Allen Downey (GitHub), professor of Computer Science at Olin College of Engineering, Think Python (repo) is one of the best-rated books for those starting with Python.
It covers the basics of the language, including data structures and algorithms, with a focus on the programming mindset, teaching the reader how to think like a computer scientist.
It’s also part of the seven-book Learning Python series.
Best Specialized Python Books
We’ll now turn our attention to Python books with a more specialized focus.
Python for Everybody: Exploring Data in Python 3
- Author: Dr. Charles Russell Severance
- Publishing: independent (April 9, 2016)
- Paperback: 247 pages
- Ranking on Amazon: 4.6/5 (2,575 ratings)
Charles Russell Severance (GitHub) (or Dr. Chuck, as many know him) is a professor at the University of Michigan, and this book is part of the Python for Everybody Specialization offered at Coursera (to which he’s a major contributor).
Python for Everybody (site, repo) has been dubbed “the most popular programming course in the world“. Not surprisingly, then, this is a great book for getting up to speed quickly on the fundamentals of data analysis, with a concise introduction to the data analysis and visualization tools you need to be a competent Python programmer.
Do you think you could handle a nearly 14-hour course based on this book? With over five million views, it may very well be worth giving it a try!
Python for Data Analysis: Data Wrangling with pandas, NumPy, and IPython
- Author: William McKinney
- Publishing: second edition (November 14, 2017)
- Paperback: 547 pages
- Ranking on Amazon: 4.6/5 (1,688 ratings)
Python for Data Analysis (repo) by William McKinney (blog, GitHub) is another great and quite popular data science book.
Aside from print, it’s also available for reading online.
Invent Your Own Computer Games with Python
- Author: Al Sweigart
- Publishing: fourth edition (December 16, 2016)
- Paperback: 376 pages
- Ranking on Amazon: 4.7/5 (445 ratings)
Python is not only for data science, but also for game development. And Al Sweigart (also the author of Automate the Boring Stuff with Python) has written Invent Your Own Computer Games with Python (repo) to show readers how to do this.
This book is perfect for kids and adults alike. It starts by explaining the basics of Python programming, and then guides the reader through making games like Tic Tac Toe, Hangman, and Guess the Number.
Also among the best ranked Python books, it’s on its fourth edition, which is quite something for a book on games development with Python!
A quick review and an interview with the author:
Introduction to Machine Learning with Python: A Guide for Data Scientists
- Authors: Andreas Müller and Sarah Guido
- Publishing: first edition (November 15, 2016)
- Paperback: 398 pages
- Ranking on Amazon: 4.5/5 (398 ratings)
Andreas Müller and Sarah Guido (GitHub) are both well-known Pythonists, and their book Introduction to Machine Learning with Python (repo, slide deck) is considered by some as the best book on machine learning. And it surely is no coincidence, as Andreas is core developer and co-maintainer of the popular machine learning library scikit-learn.
- supervised learning
- unsupervised learning and preprocessing
- representing data and engineering features
- model evaluation and improvement
- algorithm chains and pipelines
- working with text data
Introduction to Machine Learning with Python also part of the seven-book Learning Python series.
Python for Excel: A Modern Environment for Automation and Data Analysis
- Author: Felix Zumstein
- Publishing: first edition (April 13, 2021)
- Paperback: 335 pages
- Ranking on Amazon: 4.5/5 (208 ratings)
If you are an Excel power user, you should definitely check out Python for Excel (GitHub), by Felix Zumstein (GitHub).
Felix is a Python consultant and data analyst, and has a deep understanding of Excel. He’s also the core developer of xlwings, the open-source library for automating Excel and Google Sheets with Python.
This book is a practical guide to using Python to automate, clean up, and analyze data stored in Excel spreadsheets, and to create advanced Excel reports.
Python for Finance: Mastering Data-Driven Finance
- Author: Yves Hilpisch
- Publishing: second edition (January 8, 2019)
- Paperback: 720 pages
- Ranking on Amazon: 4.6/5 (268 ratings)
Yet another topic in which Python rules is computational finance, and if you ever need to delve into this field from an algorithmic or data-driven angle, you’ll surely end up using Python.
Author Yves Hilpisch (GitHub) has published a number of books on the topic, and Python for Finance (repo) is his most popular one to date.
With over 700 pages, it’s a lengthy book. But it does have a fairly comprehensive content:
- mastering the basics: data types and structures, numerical computing with NumPy, data analysis with pandas, and object-oriented programming
- financial data science: data visualization, financial time series, input/output operations, performance Python, mathematical tools, stochastic, statistics
- algorithmic trading: the FXCM trading platform, trading strategies, automated trading
- derivatives analytics: valuation framework, simulation of financial models, derivatives valuation, portfolio valuation, market-based valuation
Best Python Books for Hackers
Next, we’ll survey Python books that are particularly suited to those looking to use Python for hacking.
Effective Python: 90 Specific Ways to Write Better Python
- Author: Brett Slatkin
- Publishing: second edition (November 15, 2019)
- Paperback: 480 pages
- Ranking on Amazon: 4.7/5 (366 ratings)
We’re now entering expert territory, and the Effective Software Development series is a compilation of books about software development written by a number of authors. Effective Python (repo) is written and maintained by Brett Slatkin (blog, GitHub).
The second edition is ranked among the best Python books. Among other things, it covers the following advanced topics:
- Pythonic thinking
- metaclasses and attributes
- concurrency and parallelism
- robustness and performance
- testing and debugging
Python Tricks: A Buffet of Awesome Python Features
- Author: Dan Bader
- Publishing: first edition (October 25, 2017)
- Paperback: 301 pages
- Ranking on Amazon: 4.7/5 (1,332 ratings)
Author Dan Bader (blog, GitHub) is a Python coach, trainer, speaker, and published author. His Python Tricks covers many topics — from the basics to the more advanced topics.
It’s the most rated advanced Python book. If you’re wondering who should read this book, the back cover of the book explains why it might be relevant to you:
- if you’re wondering which lesser known parts of Python you should know about
- if you’ve got experience with legacy versions of Python
- if you’ve worked with other programming languages and you want to get up to speed with Python
- if you want to make Python your own and learn how to write clean and Pythonic code
Black Hat Python: Python Programming for Hackers and Pentesters
- Authors: Justin Seitz and Tim Arnold
- Publishing: second edition (April 14, 2021)
- Paperback: 216 pages
- Ranking on Amazon: 4.7/5 (413 ratings)
Black Hat Python (unofficial repo) is a book about using Python for security research.
It’s not a book for beginners, as it requires some programming and network know-how, but it is ranked among the best books in the cyber security niche, and it’s a must-have for anyone interested in the field.
It covers topics such as:
- creating a trojan command-and-control server using GitHub
- detecting sandboxing and automating common malware tasks like keylogging and screenshotting
- extending the Burp Suite web-hacking tool
- escalating Windows privileges with creative process control
- using offensive memory forensics tricks to retrieve password hashes and find vulnerabilities on a virtual machine
- abusing the Windows COM automation
- exfiltrating data from a network undetected
One-size-fits-all Python Books
Let’s finally look at Python books that attempt to cater for everyone — from beginners to advanced users.
Python: The Bible
- Author: Maurice J. Thompson
- Publishing: independent (April 28, 2018)
- Paperback: 375 pages
- Ranking on Amazon: 4.3/5 (4,243 ratings)
If you want to learn Python all the way, from the very basics to well into advanced topics, then Python: The Bible might be your silver bullet.
The book is part of the four-book Your Place to Learn Python with Ease series, written by Maurice J. Thompson. It’s the only book in this list aimed at beginners, intermediate and advanced learners, and with over 4,000 ratings on Amazon, it’s quite a popular one, too!
Extra: Cheat Sheets!
Cheat sheets can be extremely handy when all you need is to quickly eyeball a reference.
Not surprisingly, the Python Programming Language cheat sheet, by Berajah Jayne, is a 4.8/5 stars (1,524 ratings) bestseller on Amazon! 👏
Extra: The SitePoint Library
SitePoint Premium gives you access the SitePoint Library, with a whole section dedicated to Python books and courses, including the book series by Austin Bingham and Robert Smallshire:
Python is one of the most popular programming languages of all time, and its popularity keeps growing, as it’s quite versatile and can be used for a wide variety of tasks.
Extensive as our list of books and resources is, we have, of course, left out many other options for learning Python. We wish you the best of luck in finding your way to Python expertise — whether via these books or others. 🥇🐍