in python, given a variable which holds a string is there a quick way to cast that into another raw string variable?
the following code should illustrate what im after...
def checkEqual(x, y):
print True if x==y else False
line1 = "hurr..\n..durr"
line2 = r"hurr..\n..durr"
line3 = "%r"%line1
print "%s \n\n%s \n\n%s \n" % (line1, line2, line3)
checkEqual(line2, line3) #outputs False
checkEqual(line2, line3[1:-1]) #outputs True
The closest I have found so far is the %r formatting flag which seems to return a raw string albeit within single quote marks. Is there any easier way to do this like a line3 = raw(line1)
kind of thing?