> I don't know exactly what the first non-space character is. I know the > first non-space character will be * or an alphanumeric character. How about: >>> mystring = ' ksjfkfjkfjds ' >>> print len( mystring ) - len( mystring.lstrip( ) ) 4 HTH, Daniel