Skip to content

Instantly share code, notes, and snippets.

@nguyenthang98
Created November 25, 2020 14:48
Show Gist options
  • Save nguyenthang98/5d1a2d51fc7d2e7e46b651b0954888b6 to your computer and use it in GitHub Desktop.
Save nguyenthang98/5d1a2d51fc7d2e7e46b651b0954888b6 to your computer and use it in GitHub Desktop.
FROM python:3.6.12-alpine
RUN pip install beautifulsoup4
WORKDIR /opt/python
CMD ["python"]
from bs4 import BeautifulSoup
with open("./index.html") as content:
soup = BeautifulSoup(content)
print("============SOUP==============")
print(soup.prettify())
print("==============================")
cards = soup.select(".card .card-title")
for card in cards:
print(card.text)
print("-----")
print(card.select('.text-muted'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment