读取字节会产生相互矛盾的结果
bytes_file = BytesIO(requests.get(source_url).content)
accepted_start_bytes = {
"jpeg": b'\xFF\xD8\xFF',
"png": b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A',
}
print( bytes_file.read().startswith(accepted_start_bytes['jpeg']))
print( [bytes_file.read().startswith(accepted_start_bytes['jpeg'])])
有输出
>>> True
>>> False
我想这些应该是一样的......