Matching a constant string at beginning
Fred L. Drake, Jr.
fdrake at acm.org
Thu Dec 23 08:59:01 EST 1999
François Pinard writes:
> is rather tedious. Of course, I could write a very small function to
> match a constant string at the beginning of another, but there just must
> be some idiom for doing this.
François,
Another possibility, if you're willing to use the CVS version(!), is
to use the string methods:
s = some string...
if s.startswith("Simpsons"):
do something interesting...
Or you could write that annoying little function while waiting for
1.6. ;)
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives
More information about the Python-list
mailing list