I have a html file say:
<html>...
<li id="123"></li>
<li id="3455"></li>
....
</html>
how do I get the value for all the ids alone in python using BeautifulSoup ?
the desired output is : ["123","3455"]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To get the list you want, use a list comprehension. It can be done in one line as follows (last line):