While writi string to a file I am getting an error :
'charmap' codec can't encode character '\ufb01' in position 108: character maps to <undefined>
This is what I have tried :
import re
file = open(filepath, "w")
temp_con = content
content = re.sub(r'\W+ \.', '', temp_con)
print(content)
file.write(content)
The string when printed is :
By noon they will all be at my new
house in the Victor's Village. The
reporters, the camera crews, even Effie
Trinket, my old escort, will have made
their way to District 12 from the Capitol.
I wonder if Effie will still be wearing that
silly pink wig, or if she'll be sporting
some other unnatural colour especially
for the Victory Tour. There will be others
waiting, too. A staff to cater to my every
need on the long train trip. A prep team
to beautify me for public appearances.
My stylist and friend, Cinna, who
designed the gorgeous outfits that first
made the audience take notice of me in
the Hunger Games.
If it were up to me, I would try to
forget the Hunger Games entirely. Never
speak of them. Pretend they were
How do i resolve this?
Note : I tried the suggestion to this question but that turned out to be the solution for python 2.