1# a Rstring is a string that treat backslashs as normals caracters
2#Exemple:
3#normal string
4>>> print("This is a line feed : \n and it's usefull!")
5This is a line feed :
6and it's usefull!
7# R-string
8>>> print(r"This is not a line feed /n :(")
9This is not a line feed /n :(
10
11# It's mostly used to write Paths
12# Exemple
13my_path = "C:\Users\Me\Desktop\MyFile.txt" #Don't works a all but
14my_path = r"C:\Users\Me\Desktop\MyFile.txt" #Totaly work!
1
2In python a backslash is used a an escape character, if you want to
3include a tab, newline, quote or any unicode character, you must use a
4backslash.
5
6'\'' - quote
7'\"' - double quote
8'\n' - newline
9'\t' - tab
10'\r' - carriage return
11'\\' - backslash
12'\u...' - unicode character (replace ... with the corresponding 4-digit number)
13'\b' - backspace
14'\f' - form feed
15'\ooo...' octal value (replace ...)
16'\x..' hexadecimal value (replace .. with two characters)
1Escape Sequence Meaning
2\t Tab
3\\ Inserts a back slash (\)
4\' Inserts a single quote (')
5\" Inserts a double quote (")
6\n Inserts a ASCII Linefeed (a new line)