Python Forum
select all the span text with same attribute
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
select all the span text with same attribute
#1
after finding all spans in the object I get the results as following.
I would like to choose the different values using:
rating_chart[31].find('span',attrs={'class':"_3fVK8yi6"}).getText()

but it only shows the first answer: 1961. How do I get all the numbers: 1961, 437,116,40?

Thank you so much.

results:
'<span class="_3fVK8yi6">1,961</span>,
<span class="_2DzayJ9y"><span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:16.9445521519969%"></span></span></span>,
<span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:16.9445521519969%"></span></span>,
<span class="_3EekUCk7 _2-7CMSau" style="width:16.9445521519969%"></span>,
<span class="_3fVK8yi6">437</span>,
<span class="_2DzayJ9y"><span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:4.497867390461419%"></span></span></span>,
<span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:4.497867390461419%"></span></span>,
<span class="_3EekUCk7 _2-7CMSau" style="width:4.497867390461419%"></span>,
<span class="_3fVK8yi6">116</span>,
<span class="_2DzayJ9y"><span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:1.5509887553315238%"></span></span></span>,
<span class="RSnM6YUj"><span class="_3EekUCk7 _2-7CMSau" style="width:1.5509887553315238%"></span></span>,
<span class="_3EekUCk7 _2-7CMSau" style="width:1.5509887553315238%"></span>,
<span class="_3fVK8yi6">40</span>,...'
Reply


Messages In This Thread
select all the span text with same attribute - by JennyYang - Jul-28-2020, 02:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python 3.9 : BeautifulSoup: 'NoneType' object has no attribute 'text' fudgemasterultra 1 8,903 Mar-03-2021, 09:40 AM
Last Post: Larz60+
  trying to scrape a span inside a div using beautifulsoup CompleteNewb 2 9,031 Jan-28-2021, 01:20 PM
Last Post: snippsat
  Scrap a dynamic span hefaz 0 2,689 Mar-07-2020, 02:56 PM
Last Post: hefaz
  Using Python to get attribute text furiousfrodo 2 2,843 Dec-18-2019, 04:18 PM
Last Post: furiousfrodo
  Cannot get contents from ul.li.span.string LLLLLL 8 3,979 Nov-29-2019, 10:30 AM
Last Post: LLLLLL
  How to get visible text of Select Drop down ankitjindalbti 2 2,737 Jun-03-2019, 12:35 AM
Last Post: ankitjindalbti
  Error object has no attribute text hcyeap 3 13,905 May-21-2019, 07:12 AM
Last Post: buran
  BeautifulSoup 'NoneType' object has no attribute 'text' bmccollum 9 14,620 Sep-14-2018, 12:56 PM
Last Post: bmccollum
  selenium click a span tag metulburr 1 21,931 Nov-30-2016, 05:47 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020