Hello,
I found no example in the tutorial and other sources.
With a select(), I need to find all the elements that match, and turn the results into a comma-separated string, eg. "Author 1, Author 2, Author 3".
I do find the elements, but fail turning them into to a string:
---
Edit: Found a way
I found no example in the tutorial and other sources.
With a select(), I need to find all the elements that match, and turn the results into a comma-separated string, eg. "Author 1, Author 2, Author 3".
I do find the elements, but fail turning them into to a string:
authors_select = soup.select("a[href*=authors]") #OK
authors = ','.join(authors_select)
authors = ','.join(map(str, soup.select("a[href*=authors]")))
authors = ','.join(map(str, soup.select("a[href*=authors]").text))
print("Authors=",authors)Thank you.---
Edit: Found a way
delim = ','
authors = ''
for str in soup.select("a[href*=authors]"):
authors += (str.text + delim)
print("Authors=",authors)
