1. Install library
install requests and BeautifulSoup libraries
python3 -m pip install requests
python3 -m pip install BeautifulSoup4
2. Copy libraries folders from local installed path to Pycharm's env site-packages
3.Import libraries into python script
import requests
from bs4 import BeautifulSoup
url='http://xxxxx'
res=requests.get(url)
content=res.text
soup=BeautifulSoup(content,'html.parser')
all_ccy=soup.find_all(class_='Currency')
4. Get USD and Pound currency from website and display
Problem: the currency is displayed like this : £8.87
Solution: first to verify the response encoding
print(res.encoding)
-->ISO-8859-1
try to decode with utf-8
change content=res.text to content=res.text.encode("ISO-8859-1").decode('utf-8')
the final output : £8.87