Skip to content

Commit 2b4a9c2

Browse files
authored
Fix BUG in Python3.5
To make the read_words function can be used in Python3.5 without a BUG "TypeError: a bytes-like object is required, not 'str'"
1 parent 10d73fa commit 2b4a9c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tensorlayer/nlp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def simple_read_words(filename="nietzsche.txt"):
394394
words = f.read()
395395
return words
396396

397-
def read_words(filename="nietzsche.txt", replace = ['\n', '<eos>']):
397+
def read_words(filename="nietzsche.txt", replace = [b'\n', b'<eos>']):
398398
"""File to list format context. Note that, this script can not handle punctuations.
399399
For customized read_words method, see ``tutorial_generate_text.py``.
400400

0 commit comments

Comments
 (0)