Skip to content

Commit 8fede33

Browse files
committed
set encoding to utf-8
1 parent dc980ad commit 8fede33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

code/ch08/ch08.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
" for l in ('pos', 'neg'):\n",
199199
" path = os.path.join(basepath, s, l)\n",
200200
" for file in os.listdir(path):\n",
201-
" with open(os.path.join(path, file), 'r') as infile:\n",
201+
" with open(os.path.join(path, file), 'r', encoding='utf-8') as infile:\n",
202202
" txt = infile.read()\n",
203203
" df = df.append([[txt, labels[l]]], ignore_index=True)\n",
204204
" pbar.update()\n",
@@ -1131,7 +1131,7 @@
11311131
" return tokenized\n",
11321132
"\n",
11331133
"def stream_docs(path):\n",
1134-
" with open(path, 'r') as csv:\n",
1134+
" with open(path, 'r', encoding='utf-8') as csv:\n",
11351135
" next(csv) # skip header\n",
11361136
" for line in csv:\n",
11371137
" text, label = line[:-3], int(line[-2])\n",

0 commit comments

Comments
 (0)