Hi i'm running a program to parse a table from a HTML address. It all works fine and I'm able to print the data i'm extracting. But when i try to write a txt file with the data I get the error msg below. Anyone can help me, please? don't know what I'm missing.
myfile.write(tds[0].text+ ","+ tds[4].text+ ","+ tds[7].text+ ","+ tds[12].text+ ","+ tds[14].text+ ","+ tds[17].text)
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "teste.py", line 14, in <module>
myfile.write(tds[0].text+ ","+ tds[4].text+ ","+ tds[7].text+ ","+ tds[12].text+ ","+ tds[14].text+ ","+ tds[17].text.encode('utf8'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1: ordinal not in range(128)