鱼C论坛

 找回密码
 立即注册
查看: 2218|回复: 2

关于zip后的数据写入txt,主要是bs4后zip

[复制链接]
发表于 2017-10-25 18:57:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1.         for tel,start,end,go_time in zip(tel_list,start_list,end_list,go_time_list):
  2.             data = {
  3.                 'date':time.strftime('%F %H:%M'),
  4.                 'tel':tel,
  5.                 'start':start,
  6.                 'end':end,
  7.                 'go_time':go_time
  8.             }
  9.             print(type(data))
  10.             #with open('C:\\Users\\Administrator\\Desktop\\yhj.txt','wb') as f:
复制代码

难道需要分开写入吗,有没有直接可以写进入的方法呢
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2017-10-25 22:16:56 | 显示全部楼层
  1. i=0
  2. while True:
  3.     try:
  4.         data = {
  5.                 'date':time.strftime('%F %H:%M'),
  6.                 'tel':tel_list[i],
  7.                 'start':start_list[i],
  8.                 'end':end_list[i],
  9.                 'go_time':go_time_list[i]
  10.                 }
  11.         print(type(data))
  12.         i += 1
  13.     except IndexError:
  14.         break
复制代码


不知道可行不
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-10-26 09:36:18 | 显示全部楼层

已解决 str(data)就可以存入了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-12-25 13:39

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表