【发布时间】:2021-07-27 23:07:31
【问题描述】:
我的字典内容如下
contentDict = {
"Prefecture": "",
"Total List Number": "",
"Title": "",
"Event Validity": "",
"Available Period": "",
"Available StartDate": "",
"End Date": "",
"Last Updated": "",
"mainText": "",
"Location Tag": "",
"Event Tag": "",
"Main Image URL": "",
"innerWebSiteURL": "",
"ListLink": ""
}
和一个相同长度的内容列表。
有没有办法将列表的每个内容顺序分配给字典
我尝试使用 zip() 但失败了
字典需要按指定的顺序排序,因为我想按照提供的顺序将它添加到 mysql 数据库中。..
最终的目标是使用 to_sql() 方法将字典放入 MySQL 数据库中
我最初编码时没有考虑 MySQL,后来被告知使用 ORM to_SQL 方法来传输数据..
任何提示或指南将不胜感激
【问题讨论】:
标签: python dictionary syntax sqlalchemy orm