(Assuming you don't need to enter a string directly from Python code)
to work around the Andrew Dalke problem, simply enter a literal string in a text file, and then use this:
input_ = '/directory_of_text_file/your_text_file.txt' input_open = open(input_,'r+') input_string = input_open.read() print input_string
This will print the literal text of what is in the text file, even if it is:
' ''' """ " \
Not fun and not optimal, but it can be useful, especially if you have 3 pages of code that would require character escaping.
Jeff Hykin Mar 17 '16 at 6:19 2016-03-17 06:19
source share