简体   繁体   English

如何在 Python 中解析以下 HTML 文件并将所有问题作为列存储到 csv 中,并将其答案作为行

[英]How to parse following HTML file in Python and store into csv with all questions as columns and their answers as rows

<br>Questionnaire score: 0 out of 0<br>
<br>Question: 1: Present Location ? Ready to relocate?<br>
<br>Answer: Yes<br>
<br>Question: 2: Highest level of education and completion date<br>
<br>Answer: Bachelors<br>
<br>Question: 3: Are you authorized to work in UK?<br>
<br>Answer: Yes<br>

Questions are fixed but answers may be different.问题是固定的,但答案可能不同。 I have tried HTML parser and beautifulsoup4.我尝试过 HTML 解析器和 beautifulsoup4。

Please Help with a suitable code.请帮助提供合适的代码。 Thanks..!谢谢..!

您可以使用Scrapy最想要的框架来使用 python 进行网页抓取,使其超级简单易用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM