Skip to content

Commit

Permalink
Make sure Windows uses UTF-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mchesterkadwell committed Feb 25, 2021
1 parent 9efe2b1 commit bfb6ec7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 4-cleaning-and-exploring-text.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"text_file = Path('data', 'PREPPED-2199-0.txt')\n",
"\n",
"# Open the file, read it and store the text with the name `iliad`\n",
"with open(text_file) as file:\n",
"with open(text_file, encoding='utf-8') as file:\n",
" iliad = file.read()\n",
"\n",
"iliad[0:200]"
Expand Down Expand Up @@ -311,7 +311,7 @@
"tokens_file = Path('data', 'CLEAN-2199-0.txt')\n",
"\n",
"# Open a file and save the list of tokens inside it\n",
"with open(tokens_file, 'w') as file:\n",
"with open(tokens_file, 'w', encoding='utf-8') as file:\n",
" file.writelines(' '.join(tokens))"
]
},
Expand Down
2 changes: 1 addition & 1 deletion 5-analysis-and-visualisation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"tokens = []\n",
"\n",
"# Open the text file and append all the words to a list of tokens\n",
"with open(tokens_file) as file:\n",
"with open(tokens_file, encoding='utf-8') as file:\n",
" for token in file.read().split():\n",
" tokens.append(token)\n",
"\n",
Expand Down

0 comments on commit bfb6ec7

Please sign in to comment.