Link to Thread.
As shown bye @ibreeden,can make so it's CSV and import that to Excel.
This is the simplest way.
Can show how it's done if include Pandas as mention in other Thread.
Can save
As shown bye @ibreeden,can make so it's CSV and import that to Excel.
This is the simplest way.
Can show how it's done if include Pandas as mention in other Thread.
Can save
df.to_excel
directly to .xlsx
format.import requests from bs4 import BeautifulSoup import pandas as pd url = 'https://connectedinvestors.com/member/jonathan-kessous/friends/2' url_get = requests.get(url) soup = BeautifulSoup(url_get.content, 'html.parser') record = {} for tag in soup.find_all('div', class_="investorcard clearfix"): h4 = tag.find('h4') record[h4.a.text.strip()] = tag.attrs['id'] df = pd.DataFrame(list(record.items()), columns=['Name', 'ID']) print(df) df.to_excel("output.xlsx", index=False)
Output: Name ID
0 Jonathan Kessous 454517
1 Tracy Williams 970885
2 Amanda Taylor 552089
3 Jason Stemo 1091251
4 Gerardo Marina 647958
5 Robin Bogin 377596
6 Foster Algier 311283
.....ect
In Excel: