I'm trying to do something I'm sure is simple. But I'm a bit baffled.
I have 3 for loops, each time the for loops runs it takes a certain piece of data from the next document in the database. So if I change LastWrite_Time['result'][:1] to LastWrite_Time['result'][:2] then I get the date string from the first 2 documents in the directory.
I want to print the LastWrite_Time, DeltaTimeBetweenPoints, Data together for the first document, then again for the second document, until the nth document. I have been trying some while loop stuff but I'm just not getting there. And if possible print each not a new file, but I think I figure out the last bit.
for T in LastWrite_Time['result'][:n]:
print 'Time & Date =',T['value']
for D in DeltaTimeBetweenPoints['result'][:n]:
print D['value']
for a in Data['result'][:n]: #only print the first result in the list
print a['value']
list1 = LastWrite_Time['result']
list2 = DeltaTimeBetweenPoints['result']
list3 = Data['result']
for T, D, A in zip(list1, list2, list3):
print 'Time & Date =',T['value']
print D['value']
print a['value']
This will at first take the 1st element of each list and print values, then the 2nd element of each list and print them, and so on.
zip takes lists and iterates the elements from each list one by one, for all the lists.