Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

Python method chaining in a for loop [duplicate]

$
0
0

I have a list of html tags defined as below:

tags = ["text1", "text2", "text3"]

I will need to use theses values in a method chaining as shown below:

soup.find("div", class_="text1").find("div", class_="text2").find("div", class_="text3").text

Since the list is dynamic, is there any way i can make the method chaining find() dynamic as well (in a for loop maybe?)


Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>