Returning the lowest index for the first non whitespace character in a string in Python

python, string, string-matching

Solution

>>> s = "   xyz"
>>> len(s) - len(s.lstrip())
3

Problem

What's the shortest way to do this in Python? ``` string = " xyz" ``` must return index = 3

Original source

Related problems