I'm working currently on a basic project, where I want to visualize later some data logged by some sensors.
I have a file with numbers:
75
0
0
30
35
32
38
45
53
44
51
62
43
34
56
42
28
32
43
56
43
46
16
33
48
...
And I want to create a list of lists, by every sub list will contain 6 element from the original ones, like [75,0,0,30,35,32],[38,45,53,44,51,62],...].
f = open("log2.txt", "r")
content = f.readlines()
 
# Variable for storing the sum
idx = 0
line = []
db =  [] 
# Iterating through the content
for number in content:
    print(idx%6)
    if idx % 6 == 0:
        #newline
        db.append(line)
        line = []
        print("AAAAA")
    else:
        #continue line
        line.append(int(number))
    idx += idx+1
print(db)
But the result of db is only [[]]. Why? How can I do it well?
 
     
     
     
    