Category Archives: Python

Send mail from your Gmail account using Python

Here, we are going to learn how to send a simple basic mail using Python code. Python, being a powerful language don’t need any external library to import and offers a native library to send emails- “SMTP lib”. “smtplib” creates a Simple Mail Transfer Protocol client session object which is used to send emails to… Read More »

Generate a graph using Dictionary in Python

Prerequisite – Graphs To draw graph using in built libraries – Graph plotting in Python In this article, we will see how to implement graph in python using dictionary data structure in python. The keys of the dictionary used are the nodes of our graph and the corresponding values are lists with each nodes, which… Read More »

Junk File Organizer in Python

Basically, as a lazy programmer my desktop is full of files (Junk Files). Due to the large number of files, it is a daunting task to sit and organize each file. To make that task easy the below Python script comes handy and all the files are organized in a well-manner within seconds. Screenshot before… Read More »

Reading and Writing to text files in Python

Python provides inbuilt functions for creating, writing and reading files. There are two types of files that can be handled in python, normal text files and binary files (written in binary language,0s and 1s). Text files: In this type of file, Each line of text is terminated with a special character called EOL (End of… Read More »

Formatted text in Linux Terminal using Python

This article demonstrates how to print formatted text in Linux terminal using Python programming language. Formatted text(also called styled text or rich text) as opposed to plain text, has styling information like: color (text color, background color), style (bold or italic), and some other special features like Strike-through text, underlined text, hyperlinks, etc. In a… Read More »

Desktop Notifier in Python

This article demonstrates how to create a simple Desktop Notifier application using Python. A desktop notifier is a simple application which produces a notification message in form of a pop-up message on desktop. Notification content In the example we use in this article, the content that will appear as notification on desktop is the top… Read More »

pprint : Data pretty printer in Python

This article is about a pretty useful built-in module in Python, pprint. The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a well-formatted and more readable way! Let us consider an example: The above code is for getting the geocode information of a place using Google Maps API in JSON format.… Read More »

eval in Python

This article discusses a built-in function in Python, eval. It is an interesting hack/utility in Python which lets a Python program run Python code within itself. The eval() method parses the expression passed to it and runs python expression(code) within the program. The syntax of eval is: eval(expression, globals=None, locals=None) expression: this string is parsed… Read More »

Linear Regression (Python Implementation)

This article discusses the basics of linear regression and its implementation in Python programming language. Linear regression is a statistical approach for modelling relationship between a dependent variable with a given set of independent variables. Note: In this article, we refer dependent variables as response and independent variables as features for simplicity. In order to… Read More »

Short Circuiting Techniques in Python

By short circuiting we mean the stoppage of execution of boolean operation if the truth value of expression has been determined already. The evaluation of expression takes place from left to right. In python, short circuiting is supported by various boolean operators and functions. Short Circuiting in Boolean Operators The chart given below gives an… Read More »