Python BeautifulSoup: Find the length of the text of the first <h2> tag of a given html document
BeautifulSoup: Exercise-5 with Solution
//-->Write a Python program to find the length of the text of the first <h2> tag of a given html document.
Sample Solution:
Python Code:
Sample Output:
Length of the text of the first <h2> tag: 28
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to extract the text in the first paragraph tag of a given html document.
Next: Write a Python program to find the text of the first attribute tag of a given html text.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.