I need some help with my code. I want to count on the values to see how many I have got in total.
Example: I have the output values 1, 70, 139, 208, 277, 346 which I have 6 value.
Here is the code:
test = con.cursor()
test.execute("SELECT COUNT(*) FROM programs")
x = test.fetchone()[0]
for running_total in xrange(1, x + 1, 69):
print running_total
Here is the output:
18:09:36 T:7572 NOTICE: 1
18:09:36 T:7572 NOTICE: 70
18:09:36 T:7572 NOTICE: 139
18:09:36 T:7572 NOTICE: 208
18:09:36 T:7572 NOTICE: 277
18:09:36 T:7572 NOTICE: 346
18:09:36 T:7572 NOTICE: 415
18:09:36 T:7572 NOTICE: 484
18:09:36 T:7572 NOTICE: 553
18:09:36 T:7572 NOTICE: 622
18:09:36 T:7572 NOTICE: 691
18:09:36 T:7572 NOTICE: 760
18:09:36 T:7572 NOTICE: 829
18:09:36 T:7572 NOTICE: 898
18:09:36 T:7572 NOTICE: 967
18:09:36 T:7572 NOTICE: 1036
18:09:36 T:7572 NOTICE: 1105
How I can add the values to see how many I have got in total?
Aucun commentaire:
Enregistrer un commentaire