If I have a string, i.e.:
s = "\'Quote Example\'\tby person\n"

How can I display it to view the special characters untranslated, to see:
"\'Quote Example\'\tby person\n"

instead of:
'Quote Example' by person

I need to know mostly for debugging purposes since the string is generated and doesn't follow a set format.

Simply use the repr command:

>>> print(repr(s))
"'Quote Example'\tby person\n"
>>> print(s)
'Quote Example'	by person

>>>

Awesome thanks!

Should be noted that Python won't mutate your string. If you say s = "'Quote Example'\tby person\n" s will always be that string unless you reassign it. When you print it, python interprets the '\t's to be tabs, but s is still the same.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.