无法将某些段落写入Excel单元格XLWT

2024-06-16 10:27:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在从

http://www.wotif.com/hotel/View?hotel=W20307&page=1&adults=2&region=1&setCurrency=true&userCurrencyCode=USD

使用BeautifulSoap库并使用xlwt-future-0.8.0将结果保存到Excel中。你知道吗

所有内容都已成功擦除,但当我的代码到达scraping“Premier Full Harbor B&B”酒店描述并写入Excel时,单元格为空。下面是一个片段,描述不完整

if rooms.select("p.deal-description"):
   #room description
   print("Deal Desc " + rooms.select("p.deal-description")[0].text.strip())
   worksheet.write(file_row_number, 4,rooms.select("p.deal-description")[0].text.strip()) 

“Premier Full Harbor B&B”之前的所有房间描述刮取并成功输入Excel。你知道吗

有什么问题吗?这个描述中有些难以辨认的字符?你知道吗


Tags: textcomhttpwwwdescriptionexcelselecthotel