Download profile pictures from Instagram using python

In some cases, we all would have wanted to download the profile picture of a person from Instagram. On Instagram we can only be able to see the profile picture of a user as a very small thumbnail. What if we could view the profile picture of the user and even save it? Python let […]

Read More

Generate QR code using python – pyqrcode

In this article we are going to see how we can generate qr code in python using the pyqrcode module. There are also various libraries available to perform this process. This one is simple and easy to use. Let us get to the process. pyqrcode The pyqrcode module is a QR code generator that is simple to […]

Read More

Create “Hangman” game using python

Hangman is just a simple gam for two or more players. One player has to come up with a word or a phrase and the other person has to identify the word or phrase. The game is limited to a certain number of guesses. How this game works? The word to guess is represented by […]

Read More

Try/Except in python – Exception handling in python

When we start out programming our scripts are simple and straightforward and, most importantly, we tend to assume a perfect operating environment. Every variable will always exist and the data will be properly formed. If only the real world were so reliable! The truth is that if something can fail, it will. Being prepared for […]

Read More

Ternary operator in python

Ternary Operators Ternary Operators are your classic if-then-else statements, but expressed in a single line. For example: Can be translated to: Syntax An if-then-else statement MUST have an else argument, otherwise your code will crash. You can also nest these statements; however, it is best practice to simply write the if statements separately if you have more than one expression.

Read More

Measure execution time in python using timeit module

By reading this article, you will learn how to measure the performance and execution time of your code in Python. According to the official documentation, the timeit module: “…provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a callable one. It avoids a number of common traps […]

Read More

Copy paste text to clipboard using python – pyperclip

We deal with copying and pasting text every day. But what if we could copy a text to the clipboard or paste the copied text from the clipboard to the terminal using python?This can be achieved using a python library called pyperclip. Installation Pyperclip is a cross-platform Python module for copy and paste clipboard functions. It […]

Read More

Collections in python – named tuple, deque, counter

Python collections are a module in the Python Standard Library, containing extra features and data types that you can use to your advantage. In this article, I plan to touch the 3 most common and usable ones, but I encourage you to research more. namedtuple namedtuple is an easy way to represent a small simple […]

Read More

Loop through dictionaries in python

Dictionary      A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values. Using .keys() one method of iterating over the keys in a dictionary is to use the .keys() method which returns a dict_keys object that is then iterated […]

Read More

Partition method in python [partition()]

Python’s data types are a treasure trove of built-in goodies. One of those goodies is the partition method — an alternative to the popular split() method. The partition() method is used to break up a string based on a specified substring and all parts of the original string in a three-value tuple. Implementing the partition() Method Since partition() is a method, […]

Read More