Как я могу очистить таблицу лидеров моего университета от компьютерных фанатов? [закрыто]Python

Программы на Python
Anonymous
Как я могу очистить таблицу лидеров моего университета от компьютерных фанатов? [закрыто]

Сообщение Anonymous »

Я пытался очистить таблицу лидеров платформы кодирования GeeksForGeeks.
Приведенный код должен работать отлично. Но это совершенно не работает.
import requests
from bs4 import BeautifulSoup

try:

for page in range(1,3):
url = 'https://www.geeksforgeeks.org/colleges/ ... +str(page)

r = requests.get(url)

soup = BeautifulSoup(r.content, 'html.parser')

# Find all user profile divs
user_profile_divs = soup.find_all('div', class_='UserCodingProfileCard_userCodingProfileCard__0GQCR')

for user_profile in user_profile_divs:
# Extract user details
user_name = user_profile.find('p', class_='UserCodingProfileCard_userCodingProfileCard_dataDiv_data--linkhandle__lZchE').text
practice_problem = user_profile.find('p', class_='UserCodingProfileCard_userCodingProfileCard_dataDiv_data--value__3A8Kx').text
coding_score = user_profile.find('p', class_='UserCodingProfileCard_userCodingProfileCard_dataDiv_data--value__3A8Kx').text
potd_streak = user_profile.find('p', class_='UserCodingProfileCard_userCodingProfileCard_dataDiv_data--value__3A8Kx').text

# Print the extracted information
print(f"User Name: {user_name}")
print(f"Practice Problem: {practice_problem}")
print(f"Coding Score: {coding_score}")
print(f"POTD Streak: {potd_streak}")
print("\n")

except Exception as e:
print(e)


Подробнее здесь: https://stackoverflow.com/questions/784 ... ksforgeeks

Вернуться в «Python»