From the link, the r prefix is about raw string. Actually, there are some situations that cause me very difficult to understand the r's function. Let me express my opinion:
'H:\\Education'
equalsr'H:\Education'
, as r prefix means not convert characters. But, if tested in Python,'H:\Education'
equals'H:\\Education'
. What is the function of r here,\
equal\\
no matter there is r leading?- As
'H:\Education'
equals'H:\\Education'
,'H:\Education\'
should equal'H:\\Education\\'
or'H:\Education\\'
or'H:\\Education\'
, but actually, these four are not the same in Python; Why? Is it about the location of\
or\\
? - If r does nothing in list 1, why
r'C:\Program Files\7-Zip\7z.exe'
is right but'C:\Program Files\7-Zip\7z.exe'
is not right? r'H:\Education\'
is wrong, why?
So, sometimes r has function, sometimes not. How can I tell them and make the right choice?