![](/img/trans.png)
[英]If I append more than one of the same thing to a list and i want to get rid of one of them how do i know which one it is?
[英]I want to extract more than one paragraph to a csv file, but I want them in separate columns rather than in one big column
result = hxs.select('//*[@id="uobcms-content"]/div/div/p').extract() [1]
这将提取该div中的第二段,但是我想要所有这些。 我知道删除[1]会提取所有段落,但是我想将它们全部提取到不同的列中。 我试过[1,2,3,4]和[1 + 2 + 3 + 4]无济于事。
尝试:
result = hxs.select('//*[@id="uobcms-content"]/div/div/p').extract() [1:]
这称为切片。 它将列表从第一个元素(从0开始计数)切到末尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.