![]() ![]() But in reality, when you print(type page_body) you'll see it is not a string but it works fine. When you try to print the page_body or page_head you'll see that those are printed as strings. Let's take a look at how you can extract out body and head sections from your pages. Try to run the example below: import requests text too, and it will give you the full markup. text on these to get the string, but you can print them without calling. It is equally easy to extract out certain sections too. In the last lab, you saw how you can extract the title from the page. This was also a simple lab where we had to change the URL and print the page title. The solution for the lab would be: import requests Looking at the example above, you can see once we feed the ntent inside BeautifulSoup, you can start working with the parsed DOM tree in a very pythonic way.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |