Python 3.6Readwrite file transcoding

I picked the code of a website. How can I write it to the txt document? how can I write it to the document? here is my code and error report

Mar.03,2021

The parameter encoding of

open is set to 'utf-8''. If you repeatedly change the code and report an error, errors= 'ignore' (or' replace')
also use the with statement to manually close the file object.
finally, 'html' is not a good variable name

.
with open('douban.txt','w',encoding='utf-8',errors='replace') as f:
    f.write(html)
print( ":",open('douban.txt','r').read() )
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46d3f-44bf4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46d3f-44bf4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?