python爬虫数据显示问题



```python
from pyquery import PyQuery as pq
import requests
import csv

def download_page_source(url):   #请求源代码
 resp = requests.get(url)
 resp.encoding = "utf-8"
 return resp.text
#  return resp.text
dic ={}

def parse_data(source):
    query = pq(source)
    divs = query(".cm-content-box").items()
    for div in divs:
        chezhuname = div("div>div>a>div>div>span:nth-child(1)").text()
        chexing = div("div > a >div:nth-child(1)>div:nth-child(1)>p").text()
        carmoney= div("div > a >div:nth-child(1)>div:nth-child(1)>div>span:nth-child(2)>span:nth-child(2)").text()
        youhao = div("div > a >div:nth-child(1)>div:nth-child(1)>div>span:nth-child(3)").text()
        time =div("div > a >div:nth-child(1)>div:nth-child(1)>div>span:nth-child(4)>span:nth-child(2)").text()
        print(time,chezhuname)
 
        
     def main(url):
    page_source = download_page_source(url) 
    parse_data(page_source)

if __name__ == '__main__':
 url = "https://dianping.yiche.com/songplusdm/koubei/"

 main(url)



如何将爬虫到的数据一行一行对应出来,并且保存到csv格式文件中
格式如下:
车主:新宋婆 车型:宋PLUS新能源 2021款 DM-i 1.5L 两驱 旗舰PLUS 裸车价:19.98万 油耗 2.8L/100km 购车时间:2022-01


我现在输出单个数据的显示不是一一对应的,而是散乱的。

如图:
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/242613703856129.png "#left")

首先,你这里写错了
divs = query(".cm-content-box").items()

错误图片并没有成功上传啊!!
将爬虫到的数据一行一行对应出来,并且保存到csv格式文件中这个你可以参考一下这篇博客:前程无忧爬虫,仅供学习使用_渔戈的博客-CSDN博客

有些数据你没有获取到,现在你只获取到了车主名,车型和油耗,而且你所有
的内容都合并成了一个字符串,需要先解析字符串才能按照你给出的格式写入
scv文件,要不你先修改获取到全部数据