Sep-12-2023, 03:00 AM
The issue you're encountering is due to the interpretation of escape characters in command-line parameters. In command-line parameters, the backslash \ is typically used to escape special characters, causing the backslashes in your input paths to be interpreted as escape characters rather than regular characters. To obtain the raw path strings, you can use raw strings to represent the parameters.
In Python, you can create a raw string by prefixing the string with a lowercase "r". This instructs Python not to interpret escape characters in the string. For example:
import sys
if len(sys.argv) > 1:
path1 = r"C:\Ordner 1\"
path2 = r"D:\test 2\"
print(path1)
print(path2)
In Python, you can create a raw string by prefixing the string with a lowercase "r". This instructs Python not to interpret escape characters in the string. For example:
import sys
if len(sys.argv) > 1:
path1 = r"C:\Ordner 1\"
path2 = r"D:\test 2\"
print(path1)
print(path2)