Python - Raw String Literals
问题 I don't understand how raw string literals work. I know that when using r it ignores all specials, like when doing \n it treats it as \n and not as a new line. but then I tried to do this: x = r'\' and it said SyntaxError: EOL while scanning string literal and not '\' why? did I understanded it correctly? and also what is the explanation for this : print r'\\' # gives '\\' print r'\\\' # gives SyntaxError 回答1: The only way to put in a single quote into a string started with a single quote is