[Tutor] beginsWith multiple prefixes

Kent Johnson kent37 at tds.net
Fri Dec 26 03:25:17 CET 2008


On Thu, Dec 25, 2008 at 12:46 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:

> for d in os.listdir():
>   if MyString(d).beginswith(....):
>
> Which isn't that cumbersome. d is still available for
> subsequent processing and acces to normal string
> methods is still useful , as in:
>
> for d in os.listdir():
>   if MyString(d).upper().beginswith(....):

But that won't work, the result of calling upper() will be a normal
str, not a MyString.

Kent


More information about the Tutor mailing list