
84
Keysight M8070A Programming Guide
3
Programming Examples
# iterate over the data
# first element ([0]) is a module identifier, discard
# items are then grouped in bundles of six, per header above
# we need to insert a comma or LF after each item, depending on pos
for idx,data in enumerate(results):
if (idx==0):
# do nothing, this is the module identifier
pass
elif (idx%6==0):
# output ending in a newline
#print data
f.write(data + "\n")
else:
# output ending in a comma
#print data + ",",
f.write(data + ",")
# close file and move on!
f.close()
print "written to file"