How do I count the number of spaces at the left end of a string?

Steven Howe howe.steven at gmail.com
Wed May 16 18:18:38 EDT 2007


walterbyrd wrote:
> 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.
>
>   
using builtin function rindex
 st = 'asblde  '
 >>> st.rindex(' ')

sph


-- 
HEX: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0




More information about the Python-list mailing list