Your way is pythonic but incorrect, it will also count other whitespace chars, to count only spaces be explicit a.lstrip(' ')
:
a = "
foo bar baz qua
"
print "Leading spaces", len(a) - len(a.lstrip())
>>> Leading spaces 7
print "Leading spaces", len(a) - len(a.lstrip(' '))
>>> Leading spaces 3
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…