The main thing to consider is the delimiter:
The delimiter under Windows system is: \ (backslash)
The delimiter under the Linux system is:/(slash)
When you appear in the character \, you will have to consider the escape character
An escape character is a character like \n,\t,\0, but the character behind \ is no longer the original meaning.
Characters that have special meanings in the string, for example:
In the string, \ n has a special meaning, indicating the meaning of the line break
Of course, in order to deal with this situation, Python offers two workarounds
1. Before the special characters, add \
2. When the characters that need to be escaped are relatively long, the previous approach is obviously not efficient, and there is another way
The entire string preceded by the letter R
We can look at:
(where the first path is the one I built myself) python or the more tedious way to do this: in each \ before adding \
Of course, in Linux there is no need to consider this situation,/There is no escape character in the case
Fortunately, Python supports both types of writing, so it depends on your personal preferences when filling in the file path.
Delimiter for file paths in Python