TypeError: an integer is required (got type str)
在python3的打开文件对象的open函数,以下为错误写法
read_helper=open(checkpath,"r","utf-8")
对于第三个参数,指定编码方式必须要加encoding=“utf-8”
read_helper=open(checkpath,"r",encoding="utf-8")
如果不加encoding=,则解释器默认认为第三个参数为指定buffering,这个变量本身要传入一个整形变量才行
def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True):
而对于二进制读取的模式,则不能制定编码方法,正确写法如下
read_helper=open(checkpath,"rb")