Hello i have the following html that i am getting from a beautifulsoup request
<select class="select" name="Type">
<option value="1">Test A</option>
<option value="2">Test B</option>
<option value="3">Test C</option>
<option value="4">Test D</option>
</select>
I have the following code to get me this and i can loop through it and only print out the values, but i can't print out the corresponding text for it. If i want to get the text, i would need to loop it adding the stripped_strings, but then i can only get the text, not the corresponding value. Is there a way to get both
soup = BeautifulSoup(response.content, 'html.parser')
list_a = soup.find('select', {'name':'Type'})
# This will get me only the text
for i in list_a.stripped_strings:
print(i)
# This will get me only the values
list = list_a.find_all('option')
for x in list:
val = x.get('value')
print(str(val))