Bubble Sort: Quick Tutorial and Implementation Guide

Prerequisites T0 learn about Bubble Sort, you must know: Python 3 Python data structures – Lists What is Bubble Sort? In the last tutorial, we saw how to search for an element from unsorted and sorted lists. We discovered that search efficiency is greater when the lists are sorted. So how do we sort a […]

Read More

HTML Parser: How to scrape HTML content

Prerequisites Knowledge of the following is required: Python 3 Basic HTML Urllib2 (not mandatory but recommended) Basic OOP concepts Python data structures – Lists, Tuples Why parse HTML? Python is one of the languages that is extensively used to scrape data from web pages. This is a very easy way to gather information. For instance, […]

Read More

How to Pickle: A Pickling and Unpickling Tutorial

Prerequisites Knowledge of  the following is required: Python 3 Basic Python data structures like dictionary File operations in Python Introduction Literally, the term pickle means storing something in a saline solution. Only here, instead of vegetables its objects. Not everything in life can be seen as 0s and 1s (gosh! philosophy), but pickling helps us […]

Read More

Using Python to Display Calendars

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

Using Python’s Tabnanny Module for Cleaner Code

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

Python Resources: Training Videos

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

The Difference Between __str__ and __repr__

__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

Python Comparison Operators

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

Python’s null equivalent: None

What is the null or None Keyword The null keyword is commonly used in many programming languages, such as Java, C++, C# and Javascript. It is a value that is assigned to a variable. Perhaps you have seen something like this: null in Javascript [javascript] var null_variable = null; [/javascript] null in PHP [php] $null_variable […]

Read More

Memory-Mapped (mmap) File Support in Python

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