Good afternoon. I don't understand the reason why input() function, when a string that contains backslashes hits it, doubles the number of those slashes. For example, if input() receives a string like ".\train.csv", the number of slashes will be doubled, but not when using print() to view the resulting value, but for example when adding this string with a backslash to the set. When you output this set, you can see that the number of slashes has doubled. Here's an example:
string = input("Enter your string here") # <-- Here we enter ".\train.csv"
print(string) # <-- Here we get ".\train.csv" and all is well
set_0 = {string} # <-- But if we add it to the set
print(set_0) # <-- We get {".\\train.csv"}
I understand that this is related to string operators like "\n", "\t", "\a" and so on, to prevent them input() adds another slash, but input() doesn't stop there. If we enter the string like: ".\\train.csv", then after adding it to the set and then printing that set we will get {".\\\\train.csv"} with four backslashes. For what? For what input() doubles the number of slashes here? I am sure that the answer to this question lies in the inner workings of the input() function, but unfortunately I could not find an explanation for this action. And I ask you to help me understand why it happens and for what.
Thank you in advance!