can't print '\' (single backslash) in Python -
this question has reply here:
how print backslash python? 6 answersi using python 3 , trying find ways search way insert '\' (single backslash) program.
i gettin error: syntaxerror: eol while scanning string literal
you have escape backslash:
\\ from python docs:
the backslash (\) character used escape characters otherwise have special meaning, such newline, backslash itself, or quote character.
also, @torxed mentioned in answer, can utilize prefix r or r:
string literals may optionally prefixed letter 'r' or 'r'; such strings called raw strings , utilize different rules interpreting backslash escape sequences.
r"some string \ backslash" python-3.x
No comments:
Post a Comment