COMMANDS

Put at the beginning of your script

#!/usr/bin/env python

Call UNIX command from Python

os.system(command)

Extract file extension

fileName, fileExtension = os.path.splitext('/path/to/somefile.ext')

How to make your file executable?

type:

chmod 775 myfile.py

Strings

Remove a certain string in a list

[my_list[i].replace('string_to_remove','') for i in xrange (0,len(my_list))]

Fill string with zeros to have N numbers

my_string.zfill(N)