Answer the question
In order to leave comments, you need to log in
How to fix EOL error?
Throws an error "SyntaxError: EOL while scanning string literal" when executing the code:
text = ' 0x61 0x73 0x64 '
text = text.replace('0', R'\')
text = text.replace(' ', '')
print(text)
Answer the question
In order to leave comments, you need to log in
Quote from documentation :
Even in a raw literal, quotes can be escaped with a backslash, but the backslash remains in the result; for example, r"\"" is a valid string literal consisting of two characters: a backslash and a double quote; r"\" is not a valid string literal (even a raw string cannot end in an odd number of backslashes) . Specifically, a raw literal cannot end in a single backslash (since the backslash would escape the following quote character). .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question