Temp
[Python] Dictionary Key Name 수정
ju_young
2021. 11. 26. 13:55
728x90
Dictionary key name을 수정할 수 있는 방법으로 다음과 같이 두 가지 방법이 있다.
# -- 1
dictionary[new_key] = dictionary[old_key]
del dictionary[old_key]
# -- 2
dictionary[new_key] = dictionary.pop(old_key)
[ref]
https://stackoverflow.com/questions/4406501/change-the-name-of-a-key-in-dictionary
728x90