Sign in:

read us on


Real Python at PyCon US 2019

Join the Real Python team as we reminisce about our first PyCon together, and for some of us, our first PyCon ever. Find out what our highs and lows were, and learn why none of us can get the Golden Girls theme tune out of our heads 🤦‍♂️

PyDev of the Week: Meg Ray

This week we welcome Meg Ray (@teach_python) as our PyDev of the Week! Meg teaches programming to other teachers and has developed Python-related curriculum. Meg is also the author of Code This Game, a book which will be coming out in August 2019. Let’s take some time to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I started out as an actor. I studied theater and moved to New York City to start out my career. One of the jobs I did to stay afloat while I was starting out was teaching theater classes to kids. I taught theater programs for students with disabilities as well as homeless youth. This lead me to my career as a special education teacher. I really enjoyed teaching and mentoring young people, particularly young people who have had challenges in their lives. Around this time in my life, I began to learn to program. I was having a lot of fun with it, and I also started to understand computer science education as an equity issue. I was hired at a school to teach a software engineering and game design class that was required for all 9th graders. I learned as I went. I re-designed the course to include Python in addition to block coding and to be more inclusive of students with learning differences. Now I develop curriculum and train other educators to teach computer science. Through the Cornell Tech Teacher in Residence initiative, I have been providing in-classroom coaching and support to K-8 teachers. I’ve also been working on my first book! Code This Game! is an intro to Python and computer science through designing a game. It was really fun to have the opportunity to apply everything I’ve learned about teaching Python to kids in a creative way. On a personal note, I’m a new mom. One of the priorities that I have now is building community. I DM for a D&D (with babies!) campaign, and have been thinking about other ways to make space for family and community in my life. One thing that I love about Python is the Python community. For me that means participating in my local meetup, collaborating with others to support Python eductors, and attending Pycon as a family. Continue reading PyDev of the Week: Meg Ray →


Build a Recommendation Engine With Collaborative Filtering

In this tutorial, you'll learn about collaborative filtering, which is one of the most common approaches for building recommender systems. You'll cover the various types of algorithms that fall under this category and see how to implement them in Python.


Reading and Writing Files in Python

In this course, you'll learn about reading and writing files in Python. You'll cover everything from what a file is made up of to which libraries can help you along that way. You'll also take a look at some basic scenarios of file usage as well as some advanced techniques.


The Python Square Root Function

In this quick and practical tutorial, you'll learn what a square root is and how to calculate one in Python. You'll even see how you can use the Python square root function to solve a real-world problem.


How to Use the Python or Operator

In this step-by-step tutorial, you'll learn about how the Python or operator works and how to use it. You'll get to know its special features and see what kind of programming problems you can solve by using or in Python.

Большая О: как замедляется код с увеличением объёма данных

PyDev of the Week: Scott Shawcroft

This week we welcome Scott Shawcroft (@tannewt) as our PyDev of the Week! Scott is the lead developer of CircuitPython, a variant of the Python programming language made for microcontrollers. If you’d like to see what else Scott is up to, his website is a good place to start. Let’s take a few moments to get to know Scott better! Can you tell us a little about yourself (hobbies, education, etc): I’m Scott, I graduated from the University of Washington in 2009 in Computer Engineering. Afterwards, I joined the Maps team at Google where I worked on rendering and styling of the map. I left in 2015 to do my own thing. I designed a modular flight controller system for racing quadcopters and learned about hardware at the same time. My hobbies include running, rock climbing, video gaming and thrift shopping for retro electronics (so I can put CircuitPython in them.) Continue reading PyDev of the Week: Scott Shawcroft →

Book Contest: Jupyter Notebook 101

Last year, I released a book entitled Jupyter Notebook 101. In celebration of a successful launch, I have decided to do a little contest. Rules Tweet about why you’d want to win the book and include my handle: @driscollis Send me a direct message on Twitter or via my contact form with a link to your Tweet If you don’t have Twitter, feel free to message me through the website to tell me why you’d like a copy The contest will run starting now until Thursday, July 4th @ 11:59 p.m. CST. Runners up will receive a free copy of the eBook. The grand prize will be a signed paperback copy + the eBook version!

PyDev of the Week: David Kopec

This week we welcome David Kopec (@davekopec) as our PyDev of the Week! David is the author of Classic Computer Science Problems in Python from Manning, as well as several other books. He was even interviewed about his book by Talk Python! If you would like to see what open source projects he is working on, then you should head on over to Github. Now let’s take some time to get to know David! Can you tell us a little about yourself (hobbies, education, etc)? Before I start, I want to thank Mike for including me in this series. It’s an honor. I’m an assistant professor in the Computer Science & Innovation program at Champlain College in beautiful Burlington, Vermont, USA. Before becoming a full time professor, I worked professionally as a software developer, and I’m still open to taking projects on a consulting basis. I have a bachelors degree in economics (minor in English) from Dartmouth College and a masters degree in computer science, also from Dartmouth. I’m the author of three programming books: Dart for Absolute Beginners (Apress, 2014), Classic Computer Science Problems in Swift (Manning, 2018), and Classic Computer Science Problems in Python (Manning, 2019). However, I no longer recommend the Dart book because it’s very outdated. I’m also an active contributor to open source. When I’m not working, I enjoy learning about American history, entrepreneurship, and keeping up with the world of computing (although that’s kind of my job too). I also have all the same hobbies that just about everyone has—cooking, traveling, film, reading (classics, biography, history, business dramas), television (Frasier & The Curse of Oak Island!), music, video games (Zelda & AOE2!), podcasts, stock trading, etc. Continue reading PyDev of the Week: David Kopec →


Python Community Interview With Katrina Durance

PyCon US can be a unique experience for anyone, let alone a first-timer. We caught up with a first-time PyCon US attendee, Katrina Durance, to learn about her experience and how it will influence the code she writes going forward.

PyDev of the Week: Geir Arne Hjelle

This week we welcome Geir Arne Hjelle (@gahjelle) as our PyDev of the Week! Geir is a regular contributor to Real Python. You can also find some of his work over on Github. Let’s take a few moments to get to know Geir now! Can you tell us a little about yourself (hobbies, education, etc): Sure. I grew up in a beautiful village on an island in the north of Norway. My family has since moved south, but I still go north and visit friends and enjoy the nature regularly. I’ve always enjoyed playing with numbers, so I quite naturally ended up studying mathematics at the University. I did both a Master’s and a PhD at the Norwegian University of Science and Technology in Trondheim. During the PhD, I also got to spend about a year in my favorite big city: Barcelona. To this day, I spend a week or two in Barcelona every year. After my studies, I lived three years in St. Louis, Missouri doing a Post.Doc at Washington University. Then I moved back to Norway, and I’m currently living in Oslo working with data science, mostly using Python. I spend a fair bit of my free time with programming as well. I write tutorials for Real Python and helping teach kids how to code. I enjoy being outdoors. In Norway there are great opportunities for going skiing in the winter, and hiking in the summer. At this very moment, I’m actually basking in the sun in a hammock in the forest just outside of Oslo. Finally, I should note that I love getting together with friends for a board game session. Continue reading PyDev of the Week: Geir Arne Hjelle →

ГБИ или не ГБИ: будущее многоядерного (C)Python


Developer-led Sales for Startups

This blog post contains the slides along with a loose transcript from my talk on the promises and perils of developer-led sales as an early-stage company strategy for acquiring customers.


Book Contest: Creating GUI Applications with wxPython

Last month, I released a new book entitled Creating GUI Applications with wxPython. In celebration of a successful launch, I have decided to do a little contest. Rules Tweet about the contest Send me a direct message on Twitter or via my contact form with a link to your Tweet If you don’t have Twitter, feel free to message me through the website and I’ll enter you anyway The contest will run starting now until Friday, June 21st @ 11:59 p.m. CST. Runners up will receive a free copy of the eBook. The grand prize will be a signed paperback copy + the eBook version!


How to Use Python lambda Functions

In this step-by-step tutorial, you'll learn about Python lambda functions. You'll see how they compare with regular functions and how you can use them in accordance with best practices.


How to Publish Your Own Python Package to PyPI

Learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Repository with this step-by-step course. Quickly get up to speed on everything from naming your package to configuring it using


Python Community Interview With Marlene Mhangami

Join us as we chat with Marlene Mhangami. She's a PSF Director and the co-founder of ZimboPy, a Zimbabwean non-profit that empowers women to pursue careers in tech. She's also organizing the very first PyCon Africa.

PyDev of the Week: Meredydd Luff

This week we welcome Meredydd Luff (@meredydd) as our PyDev of the Week! Meredydd is the co-founder of Anvil and a core developer for the Skulpt package. You can learn more about Meredydd on his website. Let’s take a few moments to get to know him better! Can you tell us a little about yourself (hobbies, education, etc): I’ve loved programming since I was first introduced to BASIC at the age of 7. I come from Cambridge (the old one in the UK, not the relatively-new one near Boston), and I studied here too. I actually started out as a biologist, but then switched to computer science for my PhD. I think programming is the closest thing to magic we have, and I love watching and helping people get their hands on this power. My PhD research was about building usable parallel programming systems, and now I work on Anvil, a tool to make web programming faster and easier for everyone (with Python!). When I’m not programming, I fly light aeroplanes, which I guess is what happens when your inner six-year-old makes your life decisions. I used to dance competitively (including a few years on England’s top Latin formation team), but it turns out international competitions and startups don’t play well together, so the startup won. Continue reading PyDev of the Week: Meredydd Luff →


How to Build Command Line Interfaces in Python With argparse

In this step-by-step Python tutorial, you'll learn how to take your command line Python scripts to the next level by adding a convenient command line interface that you can write with argparse.


OOP Method Types in Python: @classmethod vs @staticmethod vs Instance Methods


How to Make a Twitter Bot in Python With Tweepy

In this step-by-step tutorial, you'll learn how to make a Twitter bot in Python with Tweepy, which is a package that provides a very convenient way to use the Twitter API. You can use your Twitter bot to automate all or part of your Twitter activity.

PyDev of the Week: Valentin Haenel

This week we welcome Valentin Haenel (@esc___) as our PyDev of the Week! Valentin is a core developer of Numba and several other packages that you can see either on his website or on Github. He has also given several talks at various conferences in Europe. Let’s spend some time getting to know Valentin better! Can you tell us a little about yourself (hobbies, education, etc): I went to the University of Edinburgh to get a bachelor in computer science and to the Bernstein Center in Berlin to get a master in computational neuroscience. I tend to favour more traditional computer science topics these days such as compression algorithms and compilers. In my spare time, I spend time with my lovely wife Gloria, fly quad-line sports kites and ride longboards through Berlin. I’ve been doing Python and open-source on Github for about 10 years. Continue reading PyDev of the Week: Valentin Haenel →


How to Implement a Python Stack

In this tutorial, you'll learn how to implement a Python stack. You'll see how to recognize when a stack is a good choice for data structures, how to decide which implementation is best for a program, and what extra considerations to make about stacks in a threading or multiprocessing environment.

Мониторинг в Python проекте

Аннотации во благо

Новое в Python 3.7

Sending email with EZGmail and Python

Have you ever wanted to send an email with GMail using the Python programming language? In 2018, Al Sweigart, best-selling author of Automate the Boring Stuff with Python, created a package called EZGmail. You can also use Google’s own bindings to do this sort of thing, but it’s a lot more complicated than using EZGmail. In this article, we will take a quick look at how to use this package. Setting Up Your first step is to install EZGmail using pip. Here’s how: pip install ezgmail Then go to and click the Enable the Gmail API button. This will allow you to download a credentials.json file and also give you a client ID and client secret. You can use the latter credentials with Google’s Python API client and you can manage these credentials here if you need to. Now copy the credentials file to the location that you plan on writing your code. You will then need to run Python in your terminal in the same location that your downloaded credentials file is located. The next step is to run ezgmail.init(). This will open up a web browser to Gmail where it will ask you to allow access to your application. If you grant access, EZGmail will download a tokens file so that it doesn’t need to have you reauthorize it every time you use it. To verify everything is working correctly, you can run the following code: >>> ezgmail.EMAIL_ADDRESS '' This should cause your Gmail account name to print out. Continue reading Sending email with EZGmail and Python →

Getting the Correct Notebook Tab Across Platforms in wxPython

I was recently working on a GUI application that had a wx.Notebook in it. When the user changed tabs in the notebook, I wanted the application to do an update based on the newly shown (i.e. selected) tab. I quickly discovered that while it is easy to catch the tab change event, getting the right tab is not as obvious. This article will walk you through my mistake and show you two solutions to the issue. Here is an example of what I did originally: #   import random import wx     class TabPanel(wx.Panel):   def __init__(self, parent, name): """""" super().__init__(parent=parent) = name   colors = ["red", "blue", "gray", "yellow", "green"] self.SetBackgroundColour(random.choice(colors))   btn = wx.Button(self, label="Press Me") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(btn, 0, wx.ALL, 10) self.SetSizer(sizer)     class DemoFrame(wx.Frame): """ Frame that holds all other widgets """     def __init__(self): """Constructor""" super().__init__(None, wx.ID_ANY, "Notebook Tutorial", size=(600,400) ) panel = wx.Panel(self)   self.notebook = wx.Notebook(panel) self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_tab_change) tabOne = TabPanel(self.notebook, name='Tab 1') self.notebook.AddPage(tabOne, "Tab 1")   tabTwo = TabPanel(self.notebook, name='Tab 2') self.notebook.AddPage(tabTwo, "Tab 2")   sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.notebook, 1, wx.ALL|wx.EXPAND, 5) panel.SetSizer(sizer) self.Layout()   self.Show()   def on_tab_change(self, event): # Works on Windows and Linux, but not Mac current_page = self.notebook.GetCurrentPage() print( event.Skip()     if __name__ == "__main__": app = wx.App(False) frame = DemoFrame() app.MainLoop() Continue reading Getting the Correct Notebook Tab Across Platforms in wxPython →

Book Review: Practical Python and OpenCV

I bought Practical Python and OpenCV a couple of years ago during one of its authors Kickstarters. I started reading it and then got busy with other things. The past couple of weeks, I decided to give the book another go and was able to finish it. Note that I started reading the 3rd edition of the book without realizing there was a 4th edition. After finished the 3rd edition, I compared it to the 4th side by side and it looks like they are nearly identical, so I don’t think it matters all that much. Quick Review Why I picked it up: Computer vision / machine learning sounds interesting to me and the author has a fun blog Why I finished it: It’s short and the writing style is engaging I’d give it to: Anyone looking to get started with OpenCV in Python Continue reading Book Review: Practical Python and OpenCV →

Older Posts