Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need help pls #1

Closed
masudr4n4 opened this issue Oct 1, 2018 · 1 comment
Closed

need help pls #1

masudr4n4 opened this issue Oct 1, 2018 · 1 comment

Comments

@masudr4n4
Copy link

masudr4n4 commented Oct 1, 2018

from bs4 import BeautifulSoup import requests r = requests.get("https://coingecko.com/en") html_doc = r.content soup = BeautifulSoup(html_doc,"html.parser") scrap =soup.findAll("div",class_="coin-content center") print(scrap[0])

Output:

<div class="coin-content center">
<a href="/en/coins/bitcoin">
<span class="d-none d-lg-block font-bold">Bitcoin</span>
<span class="d-lg-none font-bold">BTC</span>
</a> </div>

ata run korle sob kisu thiki kaj kore kintu ami kono vabe r nicer info gulo te access korte parsi na.
ami chassi oi "Bitcoin" and "BTC" lekha dutite access korte jate sudu oi duti output ase.
Dhonnobad.

@masudr4n4
Copy link
Author

I did it :)
"from bs4 import BeautifulSoup
import requests

url = "https://coingecko.com/en"

page = requests.get(url)
html_doc = page.content
soup = BeautifulSoup(html_doc,"html.parser")
all_div =soup.find_all("div",attrs={"class":"coin-content center"})
for div in all_div:
print(div.a.span.string)"
now i am getting correct result but can not save in txt file or in exel file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant