Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Dick Moores
At 09:04 AM 9/25/2006, Carroll, Barry wrote: >Hello, Dick. > >Let's compare your final startswith method and the endswith method in >is_image_file: > > >>> >s.startswith("er","q","ty") >filename.endswith(('.gif', '.jpg', '.tiff')) > >>> > >Notice that, while startswith has THREE parameters

Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Carroll, Barry
> -Original Message- > Date: Mon, 25 Sep 2006 02:59:45 -0700 > From: Dick Moores <[EMAIL PROTECTED]> > Subject: [Tutor] Question about startswith() and endswith() in 2.5 > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain;

Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Dick Moores
Thanks, Kent and Andrei! I sure did miss those doubled parentheses. >>> s = "qwerty" >>> >>> s.startswith(("er","z","ty","qw","98768976","uytruytr")) True >>> s.startswith(("er","z","ty","qe","98768976","uytruytr")) False >>> s.startswith(("er","z","rty","qe","98768976","uytruytr"), 2) True

Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Andrei
Dick Moores rcblue.com> writes: > endswith( suffix[, start[, end]]) > Return True if the string ends with the specified suffix, otherwise > return False. suffix can also be a tuple of suffixes to look for. > >>> s.startswith("er","q","ty") > > Traceback (most recent call last): >File "",

Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Kent Johnson
Dick Moores wrote: > >>> s.startswith("er","q","ty") > > Traceback (most recent call last): >File "", line 1, in > s.startswith("er","q","ty") > TypeError: slice indices must be integers or None or have an __index__ method > > On http://docs.python.org/whatsnew/other-lang.html I found

[Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Dick Moores
http://www.python.org/doc/lib/string-methods.html has = startswith( prefix[, start[, end]]) Return True if string starts with the prefix, otherwise return False. prefix can also be a tuple of suffixes to look for. With optional start, test string beginn