Sign in:

read us on


Arduino With Python: How to Get Started

In this step-by-step tutorial, you'll discover how to use Arduino with Python to develop your own electronic projects. You'll learn how to set up circuits and write applications with the Firmata protocol. You'll control Arduino inputs and outputs and integrate the board with higher-level apps.

PyDev of the Week: Sophy Wong

This week we welcome Sophy Wong (@sophywong) as our PyDev of the Week! Sophy is a maker who uses Circuit Python for creating wearables. She is also a writer and speaker at Maker events. You can see some of her creations on her Youtube Channel or her website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I am a designer and maker currently working mostly with wearable electronics projects. My background is in graphic design, and I have also worked in fashion and costumes on my way to wearable electronics. I like to explore the different ways people interact with technology, and much of my work is inspired by sci-fi and pop culture. My projects often combine technology, like microcontrollers and 3D printing, with hand crafts like sculpting, painting, and sewing. Continue reading PyDev of the Week: Sophy Wong →


Basic Data Types in Python 3: Strings

There is a lot to learn on your Python journey when you are new to the programming language. Once you are comfortable writing and executing code, your first stop becomes understanding how to represent data in your code. No matter the language, there are a few basic data types you'll use all the time... (read more)


Python sleep(): How to Add Time Delays to Your Code

In this tutorial, you'll learn how to add time delays to your Python programs. You'll use decorators and the built-in time module to add Python sleep() calls to your code. Then, you'll discover how time delays work with threads, asynchronous functions, and graphical user interfaces.


The Python range() Function

In this step-by-step course, you'll master the Python range() function, learn how its implementation differs in Python 3 vs 2, and see how you can use it to write faster and more Pythonic code.


Cool New Features in Python 3.8

What does Python 3.8 bring to the table? Learn about some of the biggest changes and see you how you can best make use of them.

PyDev of the Week: Elana Hashman

This week we welcome Elana Hashman (@ehashdn) as our PyDev of the Week! Elana is a director of the Open Source Initiative and a fellow of the Python Software Foundation. She is also the Clojure Packaging Team lead and a Java Packaging Team member. You can see some of her work over on Github. You can also learn more about Elana on her website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I love to bake and cook, so my Twitter feed tends to be full of various bread pictures or whatever dish I’ve whipped up over the weekend. When I was a kid, I was completely hooked on the cooking channel—my favourite shows were “Iron Chef” and “Good Eats”—and I thought I’d become a chef when I grew up. That’s my back up plan if I ever drop out of tech! I’m Canadian, and I attended the University of Waterloo in Ontario to study mathematics, majoring in Combinatorics & Optimization with a Computer Science minor. The University of Waterloo is famous for its co-operative study program, where students take an extra year to finish their degrees and forfeit their summers off to complete 5-6 paid co-op work terms. To give my schedule a bit more flexibility, I actually dropped out of the co-op program, but prior to graduating I completed 4 co-op terms, a Google Summer of Code internship, some consulting, and even became an open source maintainer. I learned how to admin servers for the Computer Science Club, and a group of my friends and I revived the Amateur Radio Club after it had been inactive for a decade. Amateur (or “ham”) radio got me into playing with electronics, so I learned how to solder and now I occasionally build cool things like the PiDP-11 kit. And now that I can solder a PCB, I want to see if I can solder silver, so I’m signing up to take some jewellery-making classes this fall. I also take care of a bunch of wonderful, mostly low-maintenance houseplants. One day I hope to have a full-sized backyard for growing vegetables and setting up radio antennas! Continue reading PyDev of the Week: Elana Hashman →

Thousands of Scientific Papers May be Invalid Due to Misunderstanding Python

It was recently discovered that several thousand scientific articles could be invalid in their conclusions because scientists did not understand that Python’s glob.glob() does not return sorted results. This is being reported on by Vice, Slashdot and there’s an interesting discussion going on over on Reddit as well. Some are reporting this as a glitch in Python, but glob has never guaranteed that is results were returned sorted. As always, I would recommend reading the documentation closely to fully understand what your code does. It would also be a good idea if you can write tests around your code. Python includes a unittest module which makes this easier.


Emacs: The Best Python Editor?

In this step-by-step tutorial, you'll learn about using Emacs for Python development. You'll install and configure Emacs on your selected platform, then write Python code to explore its capabilities. Finally, you'll run, test, and debug Python code in the Emacs environment.


Get Started With Django: Build a Portfolio App

In this course, you'll learn the basics of creating powerful web applications with Django, a Python web framework. You'll build a portfolio website to showcase your web development projects, complete with a fully functioning blog.


Building a Python C Extension Module

In this tutorial, you'll learn how to write Python interfaces in C. Find out how to invoke C functions from within Python and build Python C extension modules. You'll learn how to parse arguments, return values, and raise custom exceptions using the Python API.

PyDev of the Week: Paul Ivanov

This week we welcome Paul Ivanov (@ivanov) as our PyDev of the Week! Paul is a core developer of IPython and Jupyter. He is also an instructor at Software Carpentry. You can learn more about Paul on his website. You can also see what he’s been up to in open source by visiting his Github profile. Let’s take some time to get to know Paul! Can you tell us a little about yourself (hobbies, education, etc): I grew up in Moscow and moved to the United States with my family when I was 10. I have lived in Northern California ever since. I earned a degree in Computer Science at UC Davis. After that, I worked on a Ph.D. in Vision Science at UC Berkeley. I really enjoy a lot of different aspects of computing, be it tinkering with hardware (especially microcontrollers) and trying out different operating systems and programming languages. Outside of things involving a keyboard, my main hobby is endurance cycling. I have a touring bike with a front basket that I’ve ridden on for a dozen 200km, two 300km, two 400km and one 600km rides. I also write in my journal (the pen and paper kind), which sometimes turns into poetry, some of which I have posted on my website. Continue reading PyDev of the Week: Paul Ivanov →


Using the Python zip() Function for Parallel Iteration

In this step-by-step tutorial, you'll learn how to use the Python zip() function to solve common programming problems. You'll learn how to traverse multiple iterables in parallel and create dictionaries with just a few lines of code.


Strings and Character Data in Python

In this course, you'll learn how to use Python's rich set of operators, functions, and methods for working with strings. You'll learn how to access and extract portions of strings, and also become familiar with the methods that are available to manipulate and modify string data in Python 3.


Preventing SQL Injection Attacks With Python

SQL injection attacks are one of the most common web application security risks. In this step-by-step tutorial, you'll learn how you can prevent Python SQL injection. You'll learn how to compose SQL queries with parameters, as well as how to safely execute those queries in your database.

PyDev of the Week: Marlene Mhangami

This week we welcome Marlene Mhangami (@marlene_zw) as our PyDev of the Week! Marlene is the PyCon Africa (@pyconafrica) chair, the co-founder of @zimbopy and a director for the Python Software Foundation. Let’s spend some time getting to know her! Can you tell us a little about yourself (hobbies, education, etc): Sure, in college I studied molecular biology. I was actually in the schools pre-medicine track because I initially thought I wanted to become a doctor. Looking back on it now I laugh because I hate blood, just the sight of it in movies makes me shut my eyes tightly, so I’m genuinely happy that didn’t work out! I went to a liberal arts college and appreciate that I had the space to take courses in other fields like philosophy and politics which I really enjoy. I get asked about what hobbies I have quite often, and I’m not sure if I have anything I do consistently enough to call a hobby. I read, and sometimes run, and love to journal. I also occasionally paint, but the last time I told someone I painted they asked me where my studios were and started listing off artists that I had never heard of before, so I like to disclaimer that I don’t paint in a way that is cultured or sophisticated but just as a way to express myself and have fun. Continue reading PyDev of the Week: Marlene Mhangami →


How to Use Generators and yield in Python

In this step-by-step tutorial, you'll learn about generators and yielding in Python. You'll create generator functions and generator expressions using multiple Python yield statements. You'll also learn how to build data pipelines that take advantage of these Pythonic tools.


Thonny: The Beginner-Friendly Python Editor

In this course, you’ll learn all about Thonny, a free Python Integrated Development Environment (IDE) that was especially designed with the beginner Pythonista in mind. It has a built-in debugger and allows you to do step-through expression evaluation.


Getting Started With Async Features in Python

This step-by-step tutorial gives you the tools you need to start making asynchronous programming techniques a part of your repertoire. You'll learn how to use Python async features to take advantage of IO processes and free up your CPU.

PyDev of the Week: Peter Farrell

This week we welcome Peter Farrell (@hackingmath) as our PyDev of the Week! Peter is the author Math Adventures with Python and two other math related Python books. You can learn more about Peter by visiting his website. Let’s take a few moments to get to know Peter! Can you tell us a little about yourself (hobbies, education, etc): I was brought up in the US, earned a B.A. in Math and taught Math for 8 years in big and small schools. I always wanted to show students the real-world applications of the stuff they were learning, all of which turned out to be computer-related. I learned to program in my 30’s in Logo by going page-by-page through Samuel Papert’s brilliant book Mindstorms. After that I taught all my math classes turtle programming. A student turned me on to Python and I never looked back. Away from the computer, I like to play guitar and watch documentaries. Continue reading PyDev of the Week: Peter Farrell →

Python Code Kata: Fizzbuzz

A code kata is a fun way for computer programmers to practice coding. They are also used a lot for learning how to implement Test Driven Development (TDD) when writing code. One of the popular programming katas is called FizzBuzz. This is also a popular interview question for computer programmers. The concept behind FizzBuzz is as follows: Write a program that prints the numbers 1-100, each on a new line For each number that is a multiple of 3, print “Fizz” instead of the number For each number that is a multiple of 5, print “Buzz” instead of the number For each number that is a multiple of both 3 and 5, print “FizzBuzz” instead of the number Now that you know what you need to write, you can get started! Continue reading Python Code Kata: Fizzbuzz →


How to Convert a Python String to int

There are several ways to represent integers in Python. In this quick and practical tutorial, you'll learn how you can store integers using int and str as well as how you can convert a Python string to an int and vice versa.


Python Debugging With pdb

In this hands-on course, you'll learn the basics of using pdb, Python's interactive source code debugger. pdb is a great tool for tracking down hard-to-find bugs, and it allows you to fix faulty code more quickly.


PyGame: A Primer on Game Programming in Python

In this step-by-step tutorial, you'll learn how to use PyGame. This library allows you to create games and rich multimedia programs in Python. You'll learn how to draw items on your screen, implement collision detection, handle user input, and much more!

PyDev of the Week: Veronica Hanus

This week we welcome Veronica Hanus (@veronica_hanus) as our PyDev of the Week! Veronica is a regular tech speaker at Python and other tech conferences and meetups. You can see some of her talks and her schedule on her website. She has been active in the Python community for the past few years. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I enjoy writing and taking pictures. For me, the challenge is to help someone feel what I was feeling when I decided the moment was picture- or story-worthy, and both take a combination of skill-that-you-can-study and plain-old-caring that I find immensely rewarding. Photo-taking excursions are one of my favorite ways to spend time with friends, because they’re a nice combination of “quiet, contemplative side-by-side activity” and “let’s get out and do something”! I once carved out time to take silly pictures with a new conference friend in a funny upside-down room at the conference venue. It amazed me how nice it felt to be fussed over after the stress of my first conference talk. As I started speaking more, I started offering to take pictures of conference attendees and many shared the same sentiment. Many people find conferences overwhelming and it’s nice to take a few minutes and relax, make a new friend, and maybe go home with new headshots. My education often surprises people because it violates many people’s expectations: I don’t hold a CS degree, and I never attended a bootcamp. In college, I studied Geology with a combined geochemical and planetary science twist. Since shifting into software, I have heard countless times “Geology!? That must have been such a… change”. Even today, comments like that feel challenging and exclusionary and early in my career shift it felt terrible. We hear again and again that having folks from diverse backgrounds help teams innovate, but when meeting someone who doesn’t fit our expectations, most of us still do a double-take. If I get that as a white degree-touting former-scientist, imagine the uncomfortable responses folks in groups with more bias encounter when we express our surprise! It turns out that my winding path toward programming has allowed me to make some of my most useful contributions. We don’t talk about it enough, but many use programming skills even if they haven’t written a line of code. If you’re considering development but are wondering how you will fit in, I encourage you to take a peek at communities like Write the Docs (their Slack), #CodeNewbie (their Twitter), or send me a hello via my Twitter or email. Continue reading PyDev of the Week: Veronica Hanus →


Python vs C++: Selecting the Right Tool for the Job

In this intermediate-level article, you'll explore the similarities and differences you'll find when comparing Python vs C++. You'll learn about memory management, virtual machines, object-oriented programming differences, and much more!

PyDev of the Week: Aymeric Augustin

This week we welcome Aymeric Augustin (@aymericaugustin) as our PyDev of the Week. Aymeric is a core developer of Django, a Python web framework. He is also an entrepreneur and speaker at several Django related conferences. You can catch up with Aymeric over on his website or check out his FOSS contributions on Github. Let’s take a few moments to get to know him better! Can you tell us a little about yourself (hobbies, education, etc): Do you know how to spot a Frenchman? That’s always the first thing they mention! Now that’s out of the way… These days my hobbies center around being the dad of three wonderful girls 🙂 We’re doing a lot of physical activity together: swimming, cycling, gardening, playing music, etc. I’m managing a software engineering department of about 200 people at CANAL+, a French audiovisual media group that operates TV services in several countries. I was trained as a generalist engineer, eventually specializing in Computer Science and Information Technology, but I learnt most of what I do on the job. Continue reading PyDev of the Week: Aymeric Augustin →

wxPython – Creating a PDF Merger / Splitter Utility

The Portable Document Format (PDF) is a well-known format popularized by Adobe. It purports to create a document that should render the same across platforms. Python has several libraries that you can use to work with PDFs: ReportLab – Creating PDFs PyPDF2 – Manipulating preexisting PDFs pdfrw – Also for manipulating preexisting PDFs, but also works with ReportLab PDFMiner – Extracts text from PDFs There are several more Python PDF-related packages, but those four are probably the most well known. One common task of working with PDFs is the need for merging or concatenating multiple PDFs into one PDF. Another common task is taking a PDF and splitting out one or more of its pages into a new PDF. You will be creating a graphical user interface that does both of these tasks using PyPDF2. Continue reading wxPython – Creating a PDF Merger / Splitter Utility →

Rotating Images in ReportLab

There are times when you want to rotate images or other objects in ReportLab while creating a PDF. For example, you might want to rotate an image by 45 degrees for watermarking purposes. Or you might need an image that runs vertically along one of the edges of the PDF. You can rotate images by using ReportLab’s canvas methods or by using its higher level Flowables that you can find in the platypus. module. Let’s start by looking at how to do this with the canvas directly! Rotating Images Using Canvas Rotating images using the canvas is kind of confusing. The reason being that when you rotate the canvas, you may end up inadvertently rotating other elements on your canvas if you’re not careful. Let’s take a look at the code: Continue reading Rotating Images in ReportLab →


Python args and kwargs: Demystified

In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add more flexibility to your functions. You'll also take a closer look at the single and double-asterisk unpacking operators, which you can use to unpack any iterable object in Python.

Older Posts