def writeTempsData(Temperature):
mydict = {
'1': {'Location': 'Adelaide','Temp Count':''},
'2': {'Location': 'Perth','Temp Count':''},
'3': {'Location': 'Melbourne','Temp Count':''},
'4': {'Location': 'Canberra','Temp Count':''},
'5': {'Location': 'Sydney','Temp Count':''},
'6': {'Location': 'Brisbane','Temp Count':''},
'7': {'Location': 'Darwin','Temp Count':''}
}
for row in mydict:
if row['Location'] == 'Adelaide':
print(daysOver('weatherAUS-1 - Practical 3.csv',value,Temperature))
So, the daysOver function is something that I am using to get a value. I want this value to be appended to the dictionary, mydict, to the 'Temp Count' key. The above is what I have.
Is there a way I can do this?
Thank you
Not sure what you want, but probably
row['Temp Count'] = daysOver('weatherAUS-1 - Practical 3.csv',value,Temperature)
perhaps
for key in mydict.keys:
for item in mydict[key]:
item['Temp count'][0] = temperature_value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.