且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

TypeError:不带编码的字符串参数

更新时间:2023-10-03 19:29:04

您没有正确使用bytes函数.检查一下:

You are not using the bytes function correctly. Check this:

>>> a = "hi"
>>> bytes(a, encoding='utf8')
b'hi'

您可以尝试:

bytes((create_jsonlines(source)), encoding='utf8')

encodingbytes函数的参数,您正在该函数之外使用它.

encoding is the argument of the bytes function, and you are using it outside of that function.