I am getting the following error:
Traceback (most recent call last):
File "C:\Books\Python\gsearch.py", line 21, in <module>
text_file.write(titles)
File "C:\Program Files\Python 3.5\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2190' in position 2936: character maps to <undefined>
The line text_file.write(titles)
is supposed to write some text stored in the titles
variable to a file. I have read other questions like this one on Stackoverflow. However, they specifically deal with console output using print
. I want to write the text to a file.