with open('sh_text.csv', 'a', encoding='utf_8_sig', newline='') as csvfile:
writer = csv.writer(csvfile)
with open('sh_text.csv', 'r', encoding='utf_8_sig', newline='') as f:
reader = csv.reader(f)
if not [row for row in reader]:
writer.writerow(['酒店名称','详细地址','星级','客房数','开业年限','电话','行政区','详情页链接'])
writer.writerow([title, add, start, rnum,whenOpen,phone,zhengqu,url])
else:
writer.writerow([title, add, start, rnum,whenOpen,phone,zhengqu,url])
实时显示csv数据
最新推荐文章于 2024-09-26 20:01:43 发布