Issue
I want to convert this from Py2:
with open(path, "wb") as f1:
for i in w_vectors:
print >>f1, i, " ".join(map(str, numpy.round(w_vectors[i], decimals=6)))
to Py3:
with open(path, "wb") as f1:
for i in w_vectors:
print (f1, i, " ".join(map(str, numpy.round(w_vectors[i], decimals=6))))
f1.close()
but it's not saving to the text file. What am I doing wrong?
Solution
Use the file
keyword parameter to print
in Python 3.
print(i, " ".join(...), file=f1)
Answered By - Keith
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.