How to combine a group of lists together
wanghao7915 at gmail.com
wanghao7915 at gmail.com
Sat Dec 21 01:47:31 EST 2019
thanks for responding!
Now I've solved this problem!
My former code is:
for j in data:
spe = j.get_text()
l_spe = spe.split()
print(l_spe)
Then I get the result:
['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details']
['4.7', 'inches']
['750', 'x', '1334']
['64', 'GB']
['2', 'GB']
['Apple', 'A11', 'Bionic,', 'Hexa-Core,', '(2x', 'Monsoon', '+', '4x', 'Mistral)']
['5.22', 'ounces']
['No']
['No']
['12', 'MP']
['7', 'MP']
['1821', 'mah']
['No']
['Yes,', 'on', 'the', 'front']
['None']
['iOS', '(Last', 'OS', 'info:', 'IOS', '11)']
['September', '2017']
Now my code is:
for j in data:
spe = j.get_text()
temp_li.extend(spe.split())
print(temp_li)
Then:
['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details', '4.7', 'inches', '750', 'x', '1334', '64', 'GB', '2', 'GB', 'Apple', 'A11', 'Bionic,', 'Hexa-Core,', '(2x', 'Monsoon', '+', '4x', 'Mistral)', '5.22', 'ounces', 'No', 'No', '12', 'MP', '7', 'MP', '1821', 'mah', 'No', 'Yes,', 'on', 'the', 'front', 'None', 'iOS', '(Last', 'OS', 'info:', 'IOS', '11)', 'September', '2017']
Bravo!
More information about the Python-list
mailing list