Skip to content
Advertisement

How to turn the following dictionary keys to another keys?

Original keys (dict_keys with tuple as keys) are:

JavaScript

How can I turn them to:

JavaScript

It is also okay to just create a new dictionary with the new keys. But I do not know how to do so either way.

Advertisement

Answer

You can use dictionary comprehension to create new dict with new keys:

JavaScript

Prints:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement