Backslash error SyntaxError: EOL while scanning string literal
Question:
I want to use a backslash in Python, but I always get an error. This is my code
fileName = "file"
linkName = "rep" + file_name
print(linkName)
The error:
SyntaxError: EOL while scanning string literal
Answers:
The error is simple. Just had the same
Use this:
fileName = "file"
linkName = "rep" + chr(92) + file_name
print(linkName)
chr(92) stands for
I want to use a backslash in Python, but I always get an error. This is my code
fileName = "file"
linkName = "rep" + file_name
print(linkName)
The error:
SyntaxError: EOL while scanning string literal
The error is simple. Just had the same
Use this:
fileName = "file"
linkName = "rep" + chr(92) + file_name
print(linkName)
chr(92) stands for