From the course: Build Three Real-World Python Applications
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
How to retrieve HTML code - Python Tutorial
From the course: Build Three Real-World Python Applications
How to retrieve HTML code
- [Instructor] Now we get to see how we can pull all the HTML code we saw on the developer tools into our Python code. The first way you could do this is by using the method .content. In this cell, we're going to type in response.content and we'll click here to run it. In your output, you will notice that we were able to successfully pull the HTML code from the website. I suggest you scroll to the top of your output so you can see the beginning of the HTML code. You may need to do this for other coding cells as well throughout this course. Using .content allows us to see the HTML code in bites which is great to have if we want the machine readable form. You can tell it is in bites with the output because it starts with this lowercase B. Another method to pull the HTML code is using .text. This allows us to have the HTML code from the response variable converted into a string and encoded using UTF-8 versus having it in bite…
Contents
-
-
-
What is web scraping?2m 57s
-
Introducing the Wisdom Pet Medicine website2m 4s
-
How to explore a webpage2m 45s
-
(Locked)
Understanding HTML code1m 56s
-
(Locked)
Understanding the requests package3m 8s
-
(Locked)
How to use the get() method2m 38s
-
(Locked)
How to retrieve webpage information4m 4s
-
(Locked)
How to retrieve HTML code1m 36s
-
(Locked)
How to use BeautifulSoup2m 20s
-
(Locked)
How to use find() and find_all() methods3m 52s
-
(Locked)
How to loop find_all() methods3m 21s
-
(Locked)
How to retrieve webpage links2m 18s
-
(Locked)
How to write HTML code to a text file2m 7s
-
-
-
-