We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 066b4d9 commit 846a727Copy full SHA for 846a727
intermediate_source/char_rnn_generation_tutorial.py
@@ -97,8 +97,8 @@ def unicodeToAscii(s):
97
98
# Read a file and split into lines
99
def readLines(filename):
100
- lines = open(filename, encoding='utf-8').read().strip().split('\n')
101
- return [unicodeToAscii(line) for line in lines]
+ with open(filename, encoding='utf-8') as some_file:
+ return [unicodeToAscii(line.strip()) for line in some_file]
102
103
# Build the category_lines dictionary, a list of lines per category
104
category_lines = {}
0 commit comments