I am trying to create a list of lists. I have the following lists.
['0.2', '0.1', '0.4', '0.9', '1.0', '1.1', '1.2']
['2.7', '3.2', '2.9', '3.8', '2.9', '2.9', '2.9']
['6.7', '6.4', '4.7', '4.5', '4.7', '5.1', '5.1']
['0.3', '0.4', '0.7', '1.7', '1.8', '2.0', '2.0']
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
Each row above I have stored in a list object called values. However when I try to run:
for ele in doc.items():
y0 = ele.attr('y0')
p = pdf.pq('LTTextLineHorizontal')
x = 0
values.clear()
for elem in p.items():
if elem.attr("y0") == y0:
x = x + 1
if x > 1:
values.append(elem.text())
print(values)
table.append(values)
for value in table:
print(value)
When I run the last two lines of code I get the following out:
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
['5.0', '5.1', '5.7', '5.7', '5.6', '5.4', '5.3']
Why is the output not the same as the list of values at the top very top I posted?
Any help would be appreciated Thanks.