Python: os.path.realpath () - how to fix non-exchangeable backslashes?
2 answers
Depending on your use case, you can evaluate the built-in function repr
to get a "printable representation of an object",
https://docs.python.org/2/library/functions.html#func-repr
path = 'D:\My Stuff\Python\my_script.py'
print(path)
D:\My Stuff\Python\my_script.py
print(repr(path))
'D:\\My Stuff\\Python\\my_script.py'
0
source to share