python生成一段日期的学生随机体温表

import xlwt
import datetime
import random

stuname = ['时欣妍','张原硕','朱馨淼','李业恒','李浩洋','毛骏赫','刘梦雨','马懿轩','张城铭','周銆函','刘畅','张艾>淇','吴逸博','张宇杰','安淇','马采薇','毛润腾','麻若瑶','聂玉树','李佳萱','张添慕','王炜皓','张瓷炫','张辰睿','张>博文','张梦璐','于夕宸','付宸威','高梓萌','孔梦洁']
s1 = '2022/4/28'
bgdate = datetime.datetime.strptime(s1, "%Y/%m/%d")
s2 = '2022/6/26'
eddate = datetime.datetime.strptime(s2, "%Y/%m/%d")

interval = int((eddate - bgdate).days) + 1

book = xlwt.Workbook(encoding='utf-8')

for i in range(0, interval, 1):
    #建立sheet
    delta = datetime.timedelta(days=1)
    sheet = book.add_sheet(str(bgdate+delta*i)[0:10])
    #建立表头
    sheet.write(0, 0, '姓名')
    sheet.write(0, 1, '体温(早)')
    sheet.write(0, 2, '体温(中)')
    sheet.write(0, 3, '体温(晚)')
    index = 1
    for name in stuname:
        sheet.write(index, 0, name)
        sheet.write(index, 1, format(random.uniform(36.0,36.9), '.1f'))
        sheet.write(index, 2, format(random.uniform(36.0,36.9), '.1f'))
        sheet.write(index, 3, format(random.uniform(36.0,36.9), '.1f'))
        index += 1


#保存表格
book.save(u"学生体温.xls")

~                                                           
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值