Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to reassign a key py

# BEFORE
print (weather_json['main']['temp'])

old_key = 'main'
new_key = 'main_weather'

weather_json[new_key] = weather_json[old_key]
del weather_json[old_key]

# AFTER
print (weather_json['main_weather']['temp'])
 
PREVIOUS NEXT
Tagged: #reassign #key #py
ADD COMMENT
Topic
Name
5+8 =