K
K
kpkkk4232020-04-22 16:01:25
Python
kpkkk423, 2020-04-22 16:01:25

How to parse just a nickname?

How to parse only nick
my code

pages = parsename.text
soup = BeautifulSoup(pages, 'html.parser')
na = soup.find('span', {"class": "nowrap win"})
print(na)

what i get
<span class="nowrap win"><img class="icon" src="http://144.76.127.94/view/image/icons/hero_on_0.png"/>
    JIунный V, 19 уровень</span>

I need to get only JIunny V

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-04-22
@kpkkk423

longNick = na.text.strip()
nick = longNick[:longNick.find(',')]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question