S
S
Sirotop2016-02-05 09:04:12
Python
Sirotop, 2016-02-05 09:04:12

Beautifulsoup returns None, what's the point?

I could not find the answer to the simplest question: if BS works without errors and as a result of parsing returns None, does this mean that there is no such element?
ps I'm trying to parse the VK friends search page

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ipanov, 2016-02-05
@Sirotop

The documentation states that if find can't find anything, it returns None. www.crummy.com/software/BeautifulSoup/bs4/doc/#find

S
Sirotop, 2016-02-05
@Sirotop

def get_html(url):
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
response = urllib.request.urlopen(req)
return response.read()
openfile= open('./files/nadym1.3.html','w',encoding='utf-8')
def parse(html):
soup = BeautifulSoup(html,"lxml")
table = soup.find('table ', class_='fl_r')
news = []
#print(link)
print(table)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question