string contains and special characters
malaclypse2 at gmail.com
Tue Oct 9 16:34:17 CEST 2012
On Tue, Oct 9, 2012 at 10:02 AM, loial <jldunn2000 at gmail.com> wrote:
> I am trying to match a string that containing the "<" and ">" characters, using the string contains function, but it never seems to find the lines containing the string
> e.g if mystring.contains("<TAG>") :
> Do I need to escape the characters...and if so how?
Strings don't have a contains() method. Assuming that mystring is
actually a string, you should be getting a very specific error,
telling you exactly what's wrong with your code (something like
AttributeError: 'str' object has no attribute 'contains').
If that isn't what you're seeing, you'll need to provide the full and
complete text of the error you are getting, and preferably enough of
your code that we can reproduce the issue and help you solve it.
More information about the Python-list