On 10/09/2012 10:02 AM, loial 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?
>

What language are you trying to use, and what version of that language? 
In all the Python versions I know of, that line would simply be a syntax
error.  There's no "contains" method in the str class, use the 'in' keyword.

    if  "<TAG>' in mystring:

No need to escape any ASCII characters except backslash.

-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to