Skip to content
Advertisement

How to combine line by line dictionary into one?

I currently have a line by line dictionary:

JavaScript

Is there a way to turn this into a one line dictionary? The outcome I would like:

JavaScript

I’m new to Python and a little lost how to do it to a dictionary.

Advertisement

Answer

Based on the comments, here is version that reads lines from a file and converts them to one dictionary:

JavaScript

Prints:

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