#searchMenu > div.menu_wrap > ul > li.first.actived > div > div > div >
div.menu_con.ng-scope > ul > li.actived > div > div.result_list > div > ul
> li:nth-child(1) > ul > li:nth-child(3)
所以我想提取所有这样的元素。你知道吗
li:nth-child(1) > ul > li:nth-child(3)
li:nth-child(2) > ul > li:nth-child(3)
li:nth-child(3) > ul > li:nth-child(3)
li:nth-child(4) > ul > li:nth-child(3)
li:nth-child(5) > ul > li:nth-child(3)
如何使用“for循环”生成代码?你知道吗
我刚试过这个代码:
address = []
for book in tags:
tag = book.select_one('li:nth-of-type(4) ').text address.append(tag)
print(address)
枚举标记并将索引值传递给选择器。像这样
希望这有帮助!干杯!你知道吗
相关问题 更多 >
编程相关推荐