Asked By – kjakeb
Is there a way to declare a string variable in python such that everything inside of it is automatically escaped, or has its literal character value?
I’m not asking how to escape the quotes with slashes, that’s obvious. What I’m asking for is a general purpose way for making everything in a string literal so that I don’t have to manually go through and escape everything for very large strings. Anyone know of a solution? Thanks!
Now we will see solution for issue: How to write string literals in python without having to escape them?
Raw string literals:
>>> r'abc\dev\t' 'abc\\dev\\t'