index.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Koala-tea_bot 作者: Toshimonster 项目源码 文件源码
def createXcel():
    workbook = xlsxwriter.Workbook('Data.xlsx')
    title = workbook.add_format({"bold": True, "align": "center", "font_size": 14})
    norm  = workbook.add_format({"italic": True, "align": "center"})
    worksheet = workbook.add_worksheet()
    worksheet.set_column('B:B', 15)
    worksheet.set_column('C:C', 15)
    worksheet.set_column('D:D', 15)
    worksheet.set_column('E:E', 15)
    worksheet.write(1, 1, "User", title)
    worksheet.write(1, 2, "Drinks Made", title)
    worksheet.write(1, 3, "Drinks Drunk", title)
    worksheet.write(1, 4, "Ratio", title)
    sorteddb = sorted(database.data.items(), key=lambda x: tryDivide('(x[1]["drinks"]/x[1]["made"])', x))
    for index, user in enumerate(sorteddb):
        worksheet.write(index + 2, 0 , index + 1, norm)
        worksheet.write(index + 2, 1 , userInfo(user[0])['name'], norm)
        worksheet.write(index + 2, 2 , user[1]["made"], norm)
        worksheet.write(index + 2, 3 , user[1]["drinks"], norm)
        worksheet.write(index + 2, 4 , str(tryDivide('(x[1]["made"]/x[1]["drinks"])', user)), norm)
    worksheet.insert_image('F3', 'KoalaTea.jpg')
    workbook.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号