data_file = open("F:\\MyPro\\data.yaml", "r", encoding='utf-8')
with open('temp.sql','r',encoding='utf-8',errors='ignore') as f:
f.write('')
运行的时候报错:
TypeError: 'encoding' is an invalid keyword argument for this function
导入io模块,改成如下
import io
with io.open('temp.sql','r',encoding='utf-8',errors='ignore') as f:
f.write('')
参考来源:https://www.cnblogs.com/milian0711/p/7132377.html
原博客用的是open函数