A comprehensive guide that takes you from the basic to advanced concepts in the Python programming language.
A series on using regular expressions with Python, with examples. Including matching characters, repetitions, captured groups, assertions, and functions.Read More
A small series on using recursion in Python, by iterating directories and modifying files.Read More
A 2-part tutorial series on encoding and decoding strings in Python 2.x and Python 3.x.Read More
A tutorial series on Python classes. It includes creating class methods, variables, inheritance, and generators.Read More
Here’s a fun thing about Python that you may or may not already be familiar with: it has a built-in calendar function you can use to display as many calendars as you like. When you import the function, you can use it to display a month of any year in standard calendar format (a month at […]Read More
Tabnanny is a module in Python that checks your source code for ambiguous indentation. This module is useful because in Python, white space isn’t supposed to be ambiguous, and if your source code contains any weird combinations of tabs and spaces, tabnanny will let you know. You can run tabnanny in one of two ways, […]Read More
Sometimes the best way to get acquainted with a new language or a new technique is to watch someone else do it first, and then jump in to try for yourself. If you like to learn that way and are wanting to improve your Python skills, check out any of the training videos or video […]Read More
__str__ and __repr__ are used in very similar ways in Python, but they’re not interchangeable. __str__ is a built in function used to compute the informal string representations of an object, while __repr__ must be used to compute the official string representations of an object. The visible difference between the informal and official representations has […]Read More
In Python, comparison operators are used to compare the values on either side of the operators and then decide the relationship between them (sometimes they’re also referred to as relational operators). What follows is a complete list of the comparison operators in Python. Some of them might be pretty self-explanatory, while others you may have […]Read More
var null_variable = null;
null in PHP
$null_variable = NULL;
null in Java
SomeObject null_object = null;
The concept […]Read More
What is a Memory-Mapped File in Python From Python’s official documentation, be sure to checkout Python’s mmap module: A memory-mapped file object behaves like both strings and like file objects. Unlike normal string objects, however, these are mutable. Basically, a memory-mapped (using Python’s mmap module) file object maps a normal file object into memory. This […]Read More
Python’s syntax is relatively convenient and easy to work with, but aside from the basic structure of the language Python is also sprinkled with small syntax structures that make certain tasks especially convenient. The lambda keyword/function construct is one of these, where the creators call it “syntactical candy”. Here we’ll examine how to use them. To understand the lambda keyword/function and their […]Read More
Often times when coding a python masterpiece, there are certain things that could go wrong when executing your masterfully designed code. Things such as files or directories that are missing, empty strings, variables that are supposed to be strings but are actually arrays at run-time. These things are called exceptions in Python. This is what […]Read More
Python strings as sequences of characters Python strings are sequences of individual characters, and share their basic methods of access with those other Python sequences – lists and tuples. The simplest way of extracting single characters from strings (and individual members from any sequence) is to unpack them into corresponding variables.
>>> s = 'Don'
>>> a, b, c = s # Unpack into variables
Unfortunately, it’s not […]Read More