Archive for July, 2014

print a text by specifying the width via a variable

July 11, 2014 Leave a comment

You want to print a text using a certain width that you want to specify via a variable. Running example:

$ ./ 
Width: 10
'     World'
Width: 20
'               World'


for _ in range(2):
    width = int(raw_input("Width: "))
    print("'{0:>{w}}'".format("World", w=width))

The sign ‘>‘ can be omitted. It simply means “align to the right”.

Tip from here.

Categories: python Tags: ,

Django show_urls formatter

July 11, 2014 Leave a comment

Today I wrote a little script to beautify the output of the command “ show_urls“. The script is available on GitHub here. For more info, visit the previous GitHub link.

Normal usage:

$ ./ show_urls


Adding the beautifier:

$ ./ show_urls |


awesome Python

July 2, 2014 1 comment

awesome-python is a curated list of awesome Python frameworks, libraries and software. Inspired by awesome-php.

Have you ever wondered what kind of packages to use for geolocation for instance? Here you will find the answer.

The good thing is that the libraries are put in categories.

Categories: python