Created
August 28, 2019 16:00
-
-
Save remilapeyre/eb8e7e5ced712a251efed91b168d3ae4 to your computer and use it in GitHub Desktop.
dict.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a function `replace_dashes` that takes a | |
# dictionnary as input and rename the keys so that | |
# every '_' is replaced by '-'. | |
# Your function should not change the values, for | |
# example, if the input is: | |
# { | |
# "key_1": "value_1", | |
# "key_2": "value_2", | |
# "key_3": { | |
# "key_4": "value_4" | |
# } | |
# } | |
# its output should be: | |
# { | |
# "key-1": "value_1", | |
# "key-2": "value_2", | |
# "key-3": { | |
# "key-4": "value_4" | |
# } | |
# } | |
print(replace_dashes({ | |
"key-1": "value_1", | |
"key-2": "value_2", | |
"key-3": { | |
"key-4": "value_4" | |
} | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment