How would you make the give code more Pythonic?
I want to get Paths out of the sample like /usr/local/sources/devel/algebra.py: def _alg(...) without the character :.
My code
import os
FunctionPath = "/usr/local/sources/devel/sage-main/build/sage/"
cmd = "grep -R 'def ' %s | cut -d' ' -f1" % (FunctionPath)
cmd += ' &'
raw_path = os.system(cmd)
path = raw_path.replace(':', '') // not working
print path
[edit]: The code cannot be written pythonically only with Built-in functions.
subprocessmodule to take care of most of the argument-escaping stuff. But there's certainly no need to resort to the shell for such trivial string slicing as this.