import subprocess

def svnversion():
    p = subprocess.Popen('svnversion', stdout=subprocess.PIPE, stderr=
        subprocess.PIPE)
stdout, stderr = p.communicate()
return stdout
How to programmatically get SVN revision number?