I am trying to check if a string in python contains escaped characters. The easiest way to do this is to set up a list of escaped characters, and then check to see if any item in the list is on the line:
s = "A & B" escaped_chars = ["&", """, "'", ">"] for char in escaped_chars: if char in s: print "escape char '{0}' found in string '{1}'".format(char, s)
Is there a better way to do this?
source share