in string

Jeff Sandys sandysj at juno.com
Thu Nov 1 17:40:29 CET 2001


I kind of understand why this (below) doesn't work.
What would you have to do to make it work?
(to make 'eggs' in 'spam and eggs' return 1)
Or what does: string member test needs char left operand
mean?

Python 1.5.2 (#2, Apr  4 2000, 13:12:48) [C] on aix4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> a = 'spam and eggs'
>>> 'e' in a
1
>>> 'eggs' in a
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: string member test needs char left operand
>>> 

I suppose I should just use the re package ;)

Thanks,
Jeff Sandys



More information about the Python-list mailing list