+ 2

How to get an HTML element text by id in Python

If i have this string: Html = '<html> <head> <title>Example title </title> </head> <body> <div class="container"> <h1 id="title">TITLE </h1> </div> </body>' I want to get the contwnt of the h1 with id "title" How??

28th Dec 2018, 9:06 PM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
2 odpowiedzi
+ 1
Python has a module called html. If you run help("html") in Python, you'll get some information about it. The document includes this link, which leads to python.org documentation about the library. https://docs.python.org/3.6/library/html
28th Dec 2018, 11:37 PM
Seb TheS
Seb TheS - avatar
+ 1
Maybe the module bs4 (Beautiful Soup) would be helpful there: https://www.crummy.com/software/BeautifulSoup/bs4/doc/
29th Dec 2018, 10:44 AM
deha
deha - avatar