[Tutor] wiki madness
Sean 'Shaleh' Perry
shalehperry at comcast.net
Fri Aug 8 22:03:25 EDT 2003
On Friday 08 August 2003 17:30, Jeff Shannon wrote:
> Kirk Bailey wrote:
> >> * no need to define caps, just use string.ascii_uppercase (and
> >> lowercase is there too)
> >
> > 1. nosuchfunction listed in the string module docs. Please advise.
> >
> >>> import string
> >>> string.ascii_lowercase
>
> 'abcdefghijklmnopqrstuvwxyz'
>
> They're data (strings), not functions, so they'd probably be listed in a
> different part of the docs.
>
he's referring to startswith(). This is a method of strings and was added in
the 2.x series. so you have:
url = 'ftp://foo.com/'
if url.startswith('http://'):
# must be http
elif url.startswith('ftp://'):
# must be ftp
you can mimic this with slicing.
if url[:6] == 'ftp://':
# must be ftp
More information about the Tutor
mailing list