Closed sameertak closed 3 years ago
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
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:
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