I scrape data from website and I used a variable to contain all lists of data.
i.e.
x = [a,d,d,d] [a,f,f,f] [a,f,g,r]
How can I put them into one list like following:
x = [[a,d,d,d],[a,f,f,f],[a,f,g,r]]
The code I used:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import csv
url = "http://www.dicj.gov.mo/web/en/information/DadosEstat_mensal/2018/report_en.xml?id=5"
html = urlopen(url)
soup = BeautifulSoup(html, 'xml')
my_data = soup.find_all('RECORD')[0:]
for tds in my_data:
x = [i.get_text() for i in tds.find_all('DATA')]
print(x)