I need help cleaning extracting HTML code, the output is showing the data with commas inbetween the information (small example shown as below). My full code is at the bottom, my code can also be found at https://github.com/aaron1986/Coursera_Ca...tats.ipynb
['Defence',
'Clean',
'sheets',
'13',
'Goals',
'Conceded',
'11',
Moreover, I would like to view the data as below.
[Defence,
Clean sheets 13,
Goals Conceded 11,
]
['Defence',
'Clean',
'sheets',
'13',
'Goals',
'Conceded',
'11',
Moreover, I would like to view the data as below.
[Defence,
Clean sheets 13,
Goals Conceded 11,
]
import requests import pandas as pd import numpy as np import seaborn as sns from urllib.request import urlopen from bs4 import BeautifulSoup >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> main_url = 'xxxxxxxx' result= requests.get(main_url) result.text >>>>>>>>>>>>>>>>> soup = BeautifulSoup(result.text, 'html.parser') print(soup.prettify()) >>>>>>>>>>>>>>>>>>>>>>>>> new = soup.find("ul", class_ = "normalStatList") new.get_text() >>>>>>>>>>>>>>>>>>>> new2 = new.get_text().replace('\n', ' ').split() new2 >>>>>>>>>>>>>