I am new and seeking help if someone can. I have been able to create a text file with the output of the defined variable weight. But it writes/prints/posts much more data than I am needing. The followin .py I have is below.
#!/usr/bin/python
import myfitnesspal
import requests
import lxml
import measurement
import six
import mock
import datetime
client = myfitnesspal.Client('username', 'password')
weight = client.get_measurements('Weight')
print weight
file = open("ChrisFitPal.txt", "w")
file.write(repr(weight) + '\n' )
file.close()
The output I get is the following in a text file But I only want it to show a snippet of the text
This is what it shows in a text file
OrderedDict([(datetime.date(2019, 1, 2), 174.4), (datetime.date(2018, 12, 26), 175.6), (datetime.date(2018, 12, 21), 175.1), (datetime.date(2018, 12, 13), 173.2), (datetime.date(2018, 12, 7), 175.0)])
I just want the text file to show the number that is in bold and italics and nothing else. So the output would be just
174.4
is this possible?