今天用python3的request写爬虫的时候遇到这个问题 查了很多,都没用,最后找到自己的解决办法 因为python3是bytes-like的,所以我们需要用split的话只能把它转为str # bytes object b = b"example" # str object s = "example" # str to bytes bytes(s, encoding = "utf8") # bytes to str str(b, encoding = "utf-8") # an alternative method # str to bytes str.encode(s) # bytes to str