python 2.7版本
with open(‘结果.html’, ‘w’, encoding=‘utf-8’) as f:
f.write(html)
运行的时候报错:
TypeError: ‘encoding’ is an invalid keyword argument for this function
1
解决:
import io
with io.open(‘结果.html’, ‘w’, encoding=‘utf-8’) as f:
f.write(html)
python 2.7版本
with open(‘结果.html’, ‘w’, encoding=‘utf-8’) as f:
f.write(html)
运行的时候报错:
TypeError: ‘encoding’ is an invalid keyword argument for this function
1
解决:
import io
with io.open(‘结果.html’, ‘w’, encoding=‘utf-8’) as f:
f.write(html)