case insensitive lstrip function?

Kelie kf9150 at gmail.com
Fri Mar 28 18:48:09 EDT 2008


Hello,

Is there such a function included in the standard Python distribution?
This is what I came up with. How to improve it? Thanks.

def lstrip2(s, chars, ingoreCase = True):
    if ingoreCase:
        s2 = s.upper().lstrip(chars.upper())
        return s[len(s)-len(s2):]
    else:
        return s.lstrip(chars)



More information about the Python-list mailing list