嗨,实际上我是想在br标签之间刮东西。 例如,以以下案例为例:-
<blockquote>
<font face="Garamond" size="5"><br>
<b>ICM Partners<br></b>
730 Fifth Avenue<br>
New York, NY 10019<br>
(212) 556-5600<br>
<br>
(<i>Gelfman Schneider</i>)<br>
<br>
<a href="http://www.icmtalent.com"target="_blank">http://www.icmtalent.com</a>
<br> </font></blockquote>
ICM Partners
730 Fifth Avenue
New York, NY 10019
(212) 556-5600
(Gelfman Schneider)
http://www.icmtalent.com
实际上,我想把它分为公司名称、公司地址、公司联系电话和公司网站。
我知道我可以通过split函数.split(<br>)
将其拆分,然后将其按顺序排列,但有时地址不仅仅是1行或2行,甚至在许多情况下也没有给出联系电话。所以我不能准确地定位任何东西。
以这宗个案为例:
<blockquote>
<font face="Garamond" size="5"><br>
<b>The Agency</b><br>
24 Pottery Lane<br>
Holland Park<br>
London W11 4LZ<br>
<br>
<a href="http://theagency.co.uk" target="_blank">http://theagency.co.uk</a><br>
</font></blockquote>
The Agency
24 Pottery Lane
Holland Park
London W11 4LZ
http://theagency.co.uk
希望你能解决它。 提前谢谢。
提取此类数据可能非常容易出错,需要在更大的数据集上进行测试
一种可能的办法是:
.stripped_strings
拆分整个条目,以提供可能行的列表address_end
的地址,如果找到,则可选电话条目李>例如:
对于您的两个示例,这将给出:
当在更大的数据集上测试时,这无疑需要改进
相关问题 更多 >
编程相关推荐