Personal tools
You are here: Home / Documentation / Extending Biskit / Various hints

Various hints

Assorted tips and tricks for advanced developers

Replace strings in many files simultaneously

For example to replace the Copyright statement in all py files of the current and all subdirectories (the "**/*py" pattern only works in zsh terminals):

perl -pi -w -e 's/ 2004-2005 / 2004-2006 /g;' **/*py

"(" or similar special characters need to be escaped with "\", for example:

perl -pi -w -e 's/\(C\) 2004-2005 /\(C\) 2004-2006 /g;' **/*py

Profiling python code


import profile 'myMethod()', 'report.out' )

## Analyzing
import pstats
p = pstats.Stats('report.out')

## long steps and methods calling them

## time consuming methods