UnicodeEncodeError
Closed this issue · 1 comments
sameertak commented
Whenever I try to run this line of code:-
with open('output.txt', mode='r+') as my_file2:
translator = Translator(to_lang="ja")
translation = translator.translate(a)
my_file2.write(translation)
It shows me:- UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-5: character maps to
sameertak commented
I need to change the line: -
with open('output.txt', mode='r+') as my_file2:
to
with open('output.txt', "w", encoding="utf-8") as my_file2: