Python ERROR:argument of type‘datetime.date‘is not iterable【解决办法】

今天爱分享给大家带来Python ERROR:argument of type‘datetime.date‘is not iterable【解决办法】,希望能够帮助到大家。
项目场景:


create_date = date.today()
tbitem['date'] = create_date

问题描述:
当将 date.today() 直接赋值给 字典时报错
ERROR:argument of type ‘datetime.date’ is not iterable

原因分析:
date.today() 返回值为 datetime.date, 不可以直接做value

解决方案:
使用 str() 将其转换为String


create_date = str(date.today())
tbitem['date'] = create_date

原文链接:https://blog.itblood.com/7387.html,转载请注明出处。
0
灭魔者1.05[PC+安卓/699M] [日系RPG/AI汉化]
灭魔者1.05[PC+安卓/699M] [日系RPG/AI汉化]
10分钟前 有人购买 去瞅瞅看

站点公告

显示验证码
没有账号?注册  忘记密码?