Python aiohttp后台导出excel文件

    xiaoxiao2026-05-15  11

    import xlwt from io import StringIO,BytesIO

    @get('/channel/download')

    def manage_download_channels():     workbook = xlwt.Workbook(encoding = 'utf8')     worksheet = workbook.add_sheet('渠道明细')     worksheet.write(0,0, '渠道编码')     worksheet.write(0,1, '渠道名称')     sio = BytesIO()     workbook.save(sio)     r = web.Response()     r.content_type = 'application/vnd.ms-excel'     r.body=sio.getvalue()     return r
    转载请注明原文地址: https://ju.6miu.com/read-1309700.html
    最新回复(0)