Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 33a7556

Browse files
Adding the Football Player Club Info
1 parent 7a053a6 commit 33a7556

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎Football_Player_Club_Info/main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import pandas as pd
2+
import requests
3+
import urllib.request
4+
from bs4 import BeautifulSoup
5+
import wikipediaapi
6+
7+
wiki_lang = wikipediaapi.Wikipedia('en',extract_format=wikipediaapi.ExtractFormat.HTML)
8+
wiki_page = wiki_lang.page('Christiano Ronaldo')
9+
page_html_text = wiki_page.text
10+
soup = BeautifulSoup(page_html_text, "lxml")
11+
def print_sections(sections, level=0):
12+
for s in sections:
13+
if 'Club career' in s.title:
14+
print(s.title)
15+
#print("%s: %s - %s" % ("*" * (level + 1), s.title, s.text[0:100]))
16+
for s in s.sections:
17+
level=level + 1
18+
print(s.title)
19+
if(s.sections is None):
20+
return
21+
else:
22+
for s in s.sections:
23+
level = level+1
24+
print(s.title)
25+
26+
#break
27+
print_sections(wiki_page.sections)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /