Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Friday, September 25, 2015

Python Hunt Series - Scripts, Modules and Packages

Python Hunt Series - Scripts, Modules and Packages

prev post in the series - Isolated Environment

In this post, let's discuss about scripts, modules and packages in python.

Before getting into packages, lets discuss on modules and scripts. A file with .py extension when ran from the terminal is called as script where as when imported called as module. 

A script can solve any purpose. Lets assume we have a need to start a server instance. we can write a script that starts the server instance. similarly we can also write a script to stop the server instance. In-fact we can write a single script that takes input as either start or stop and does it accordingly

Thursday, September 24, 2015

Python Hunt Series - Isolated Environment


Python Hunt Series - Isolated Environment 

Prev post in the series - Scaffolding


In this post, we will discuss about the virtual environment option available in Python. Virtual environment creates isolated environment which will provide us the opportunity to install python packages to our convenience without affecting the global python environment

let me give you an use case where virtual environment is must. Consider I am working on 2 projects simultaneously, for my first project I need to use django (web application framework ) version 1.6 and for my second project I need django version 1.8 or greater. In this case I cannot have django 1.6 and >1.8 co existing in the same environment.

Wednesday, September 23, 2015

Python Hunt Series - Scaffolding


Python Hunt Series - Scaffolding

Hi, this is first post in the series " Python Hunt " . To start with, I will talk about setting up environment to work on Python.

At first place we need to install Python. Python comes in 2 major versions, python 2.x and 3.x. If you are starting fresh, I would suggest to go for python 3.

You can read about the difference between python 2 and python 3 from below link


Friday, February 6, 2015

Python - Basic Template

In my first post about python, I was talking about parsing huge text files with python regular expression. I thought I should share the basic template kind of set up that I have for myself to save some time while scripting. I use this basic template in writing some quick script for immediate needs. It really saves my time.

I have commented then and there in the script to increase the readability of the script. As said in every programming books, commenting your code is a must do activity and it will help anyone to understand the script in better way.

Thursday, February 5, 2015

Python - Text Crawler

I find Python extremely useful at many scenario's. Certain kind of work I do involves lot of manual efforts and consumes lot of time. I started slowly experimenting with python then and there to automate few things with which I work.

One such case where python is very useful for me is, parsing large text files. It often happens that we need to parse huge file to pull data or parse log file to create reports. In all these cases python comes in very handy. I will share a small snippet below to show how powerful is python with regular expression module.