Skip to content

Instantly share code, notes, and snippets.

@antonu17
Last active January 9, 2019 09:12
Show Gist options
  • Select an option

  • Save antonu17/d52d51032cf5f7bc499be309ad4c5ecc to your computer and use it in GitHub Desktop.

Select an option

Save antonu17/d52d51032cf5f7bc499be309ad4c5ecc to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
def dict_update(dict, path, value):
"""
data = {
'browsers': [
{
'name': 'chrome',
'version': 70
},
{
'name': 'firefox',
'version': 60
}
]
}
>>> dict_update(data, '.browsers | select(.name=="firefox").value', 61)
data = {
'browsers': [
{
'name': 'chrome',
'version': 70
},
{
'name': 'firefox',
'version': 61
}
]
}
"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment