请教一下,我想把一条数据库数据分成多条数据存入工作表,怎么实现,分开的代码块已经写完了,现在不会将他们一一对应 sunshineLv.2入道 发布于 2024-11-18 15:59 最后回复 2024-11-19 08:38:26 问答 收藏 复制链接 新浪微博 微信扫一扫 分享 4 回复772 浏览 [图片]
好的,感谢
str1 = r.text
listx = []
j = 0
for i in json.loads(str1)['data']['rows']:
listx.append([])
listx[j].append(i['67077e9af92088be97a02174'])#车号优先级
listx[j].append(int(i['67089363f92088be97a02344']))#车型优先级
listx[j].append(int(i['67089363f92088be97a02345']))#多路阀优先级
listx[j].append(int(i['67089363f92088be97a02346']))#发动机优先级
listx[j].append(int(i['67089363f92088be97a02347']))#颜色优先级
listx[j].append(int(i['67089363f92088be97a02348']))#部门优先级
listx[j].append(i['67078119f92088be97a02187'])#总装上线日期
j=j+1
print('len====',len(listx))
参考一下吧,建议用 python 在外面跑一趟在复制到代码块中
我想把数据库里面的 name:小王//小明//小李;age:12//15//16
这种形式做成:第一条数据:小王 12
第二条:小明 15
第三条:小李 16
这不就是一条数据的吗?