在读写文件的时候,因为某些库的支持对象类型不一样,需要把得到的StreamReader对象转化成bytes
这里用到
from io import BytesIO
常用的方法是:
with aiofiles.open(file_path, 'wb') as f: await f.write(BytesIO(response.content))
在读写文件的时候,因为某些库的支持对象类型不一样,需要把得到的StreamReader对象转化成bytes
这里用到
from io import BytesIO
常用的方法是:
with aiofiles.open(file_path, 'wb') as f: await f.write(BytesIO(response.content))