I wrote a small "tool" for my Keylight 34792A, it should take a measurement and output it to me as a variable. It gives me the result in the console(print) and i would like to have the result in a json file, unfortunately I don't know what to do, can someone help me? After each scan, the file should be overwritten from the beginning.
My code:
#\n after every data
print("Werte:")
for chan in range(1, numberChannels + 1):
dmm.write("DATA:REMOVE? 1")
raw = str(dmm.read()) #ergebnisse
print(raw[0:2] + raw[4] + "." + raw[5:8] + "°" + " " + raw[-4:-1] + " " + zeitpunkt)