Skip to content

Commit 77245bb

Browse files
arjungtensorflow-copybara
authored andcommitted
Remove the 'U' argument to open() as the 'U' mode is deprecated in Python 3. In Python 3, universal new lines [1] are enabled by default, and they are controlled by the 'newline' [2] argument to open().
Ref: [1] https://docs.python.org/3/glossary.html#term-universal-newlines [2] https://docs.python.org/3/library/functions.html#open-newline-parameter PiperOrigin-RevId: 318385912
1 parent 3fcd660 commit 77245bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

neural_structured_learning/examples/preprocess/cora/preprocess_cora_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def parse_cora_content(in_file, train_percentage):
133133
random.seed(1)
134134
train_examples = {}
135135
test_examples = {}
136-
with open(in_file, 'rU') as cora_content:
136+
with open(in_file, 'r') as cora_content:
137137
for line in cora_content:
138138
entries = line.rstrip('\n').split('\t')
139139
# entries contains [ID, Word1, Word2, ..., Label]; 'Words' are 0/1 values.

0 commit comments

Comments
 (0)