how do I count spaces at the beginning of a string?
Steven Howe
howe.steven at gmail.com
Thu May 17 11:08:41 EDT 2007
Paul McGuire wrote:
On May 16, 9:02 pm, walterbyrd <walterb... at iname.com> wrote:
> The strings start with whitespace, and have a '*' or an alphanumeric
> character. I need to know how many whitespace characters exist at the
> beginning of the string.
>
using buitlin function len() and lstrip()
ax = ' asdfjlwese asdfasl '
len( ax ) - len( ax.lstrip() )
sph
--
HEX: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070517/032decb8/attachment.html>
More information about the Python-list
mailing list