startswith( prefix[, start[, end]]) Query
Carsten Haese
carsten at uniqsys.com
Thu Sep 6 10:24:43 EDT 2007
On Thu, 2007-09-06 at 07:09 -0700, cjt22 at bath.ac.uk wrote:
> Hi
>
> startswith( prefix[, start[, end]]) States:
>
> Return True if string starts with the prefix, otherwise return False.
> prefix can also be a tuple of suffixes to look for. However when I try
> and add a tuple of suffixes I get the following error:
>
> Type Error: expected a character buffer object
You are probably looking at the documentation for Python 2.5, but you're
using Python 2.4 or older:
#######################################################################
Python 2.5 (r25:51908, Oct 28 2006, 12:26:14)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "blah".startswith(("a","b"))
True
#######################################################################
Python 2.4.3 (#1, Oct 23 2006, 14:19:47)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "blah".startswith(("a","b"))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: expected a character buffer object
#######################################################################
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list