+ 1
Raw string on input?
i want to receive an input from the user, and enforce the string received to be a raw string to escape special characters, for example if the user entered "i'm a string \n", i want the " \n" to be treated as a backslash and "n", and not as a new line. i hope someone understand me, thank you.
2 Antworten
+ 5
no need to do anything as far as i can see.
I just done a simple input which had a \n and a \t and \\ and the output included everything I typed in.
+ 5
Not sure if this meets your idea, but it works with regular input:
res = input('test inp') # enter "i am a string\nhello"
print(res)
#output: "i am a string\nhello"