how do I count spaces at the beginning of a string?

Paul McGuire ptmcg at austin.rr.com
Thu May 17 08:43:38 EDT 2007


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.

....aaaaaaand what have you tried so far?

This really is a pretty basic question - to most folks on this list,
it's about the same as "how do I count the fingers on my hand?".  Is
this your first Python program?  Homework assignment?  First program
ever written in any language?  Try reading one of the online tutorials
or pick up a Python book or browse the archive from this list or the
python-tutor mailing list - you shouldn't have to read too far to
start getting an idea on how to approach this problem.   www.python.org
has links to all of these and more.

Take a stab at this problem, and if you don't have any luck, come back
(or try the python-tutor list) and post what you've tried.

-- Paul




More information about the Python-list mailing list