Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import string
tfile = open("/home/pi/minicomfile","r")
text = tfile.read()
length = len(tfile.readline())
tfile.close()
temperaturedata = text.split("\n")[length - 1]
floatdata = string.atof(temperaturedata)
temperature = floatdata / 10
intdata = int(temperature)
intdata = '%d' %intdata
output = open('/home/pi/data', 'w')
output.write(intdata)
output.close
res = '{"value":%f}' %temperature
output = open('/home/pi/datafile.txt', 'w')
output.write(res)
output.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.