import requests
from bs4 import BeautifulSoup
URL = ('https://www.nba.com/hawks/stats')
#print(URL)
#print("---------------------------------")
page = requests.get(URL)
#print(page)
#print("--------------------------------")
soup = BeautifulSoup(page.content,'html.parser')
results = soup.find(id='page')
#print(results)
#print('---------------------------------')
names = results.find_all('span', class_='playerInfo')
#print(names[0])
#print('---------------------------------')
#player_stuff = names.find('span', class_='playerName')
playerstufflist = []
for name in names:
player_stuff = name.find('span', class_='playerName')
#print(player_stuff)
if None in (player_stuff):
continue
print(player_stuff.text)
playerstufflist . append(player_stuff.text)
print('---------------------------------')
xy = input("put the letter you want to be used here:" )
print(playerstufflist)
def names_a(playerstufflist):
print(type(playerstufflist))
return playerstufflist.lower().startswith(xy)
#print(names_a)
print("-----------------------------------")
#print(player_stuff)
filtered_names = filter(names_a,playerstufflist)
print(filtered_names)
print(list(filtered_names))
I have no idea what this code is supposed to do, so I don’t know if it has any mistakes or not. What are you trying to do with this code.
if you were to guess what do u think it is
Hi @samyprince!
The best I can tell is it has something to do with basketball. However, that really doesn’t help us that much. The more details you can provide and more specific you can be will help the community better assist you.
It looks like code that prints lots of stuff and involves BeautifulSoup.
I’m really bad at guessing games for uncommented code with no description. If you want help from someone, you’ll have to describe
-
What this code is for
-
What this code should be doing but isn’t
-
What this code is doing but shouldn’t
a friend of mine asked it what it is i posted it so you could give me an insight on what it is
Your guess is as good as mine it seems. You should ask your friend what this code is for.
kk thanks