Skip to content

Commit 9054500

Browse files
authored
Add files via upload
1 parent d6496cf commit 9054500

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BeautifulSoup is a python library for pulling data out of HTML and XML files
2+
from bs4 import BeautifulSoup as BS
3+
# requests module allows you to send HTTP requests and returns a Response Object with all the response​.
4+
import requests
5+
def get_price(url):
6+
data=requests.get(url) # Accessing all required data from url site and store in data.
7+
soup=BS(data.text,"html.parser") # It takes text of page as argument and then parse it with html.parser
8+
ans=soup.find("div",class_="BNeawe iBp4i AP7Wnd").text # here the class name is passed as argument to find out that particular info in html text
9+
return ans
10+
url="https://www.google.com/search?q=bitcoin+price"
11+
ans=get_price(url)
12+
print("1 Bitcoin = ",ans)

0 commit comments

Comments
 (0)