Skip to content

Commit

Permalink
Update Python_walkthrough.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Feb 5, 2024
1 parent 6f99c92 commit a49126c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions notebooks/Python_walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,15 @@
"source": [
"**Why does this happen?**\n",
"\n",
"This happens because Python has reserved some backslash + letter combinations for some actions (see list below) and Windows, contrary to other operating systems, uses backslashs to define paths. The\n",
"This happens because Python has reserve some backslash + letter combinations for some actions (see a non-exhaustive list below) and Windows, contrary to other operating systems, uses backslashs to define paths. The\n",
"\n",
"``\\n`` (i.e. new line), \n",
"``\\t`` (i.e. Tab), \n",
"``\\t`` (i.e. horizontal Tab), \n",
"``\\b`` (i.e. backspace), \n",
"``\\f`` (form feed), \n",
"``\\ooo`` (i.e. octal value), \n",
"``\\xhh`` (i.e. hex value)\n",
"``\\v`` (vertical tab),\n",
"``\\r`` (carriage return), \n",
"``\\b`` (backspace)\n",
"\n",
"The simplest solution is to use \"raw\" strings when defining a path by adding an r before defining the string."
]
Expand All @@ -599,7 +600,7 @@
}
],
"source": [
"path = r\"C:\\Program Files\\turtle game\" # alternative solution: use double backslash \\\\ instead of single \\\n",
"path = r\"C:\\Program Files\\turtle game\" # alternative solution: use a double backslash \\\\ instead of single \\ or a forward slash\n",
"print(path)"
]
},
Expand Down

0 comments on commit a49126c

Please sign in to comment.