S
S
Samad_Samadovic2021-11-03 15:19:54
Python
Samad_Samadovic, 2021-11-03 15:19:54

How to make a string that has a dictionary into a dictionary?

#The foundation:
A = "{"A":"B"}"

Here you need to make a line with a dictionary:
#Result:
{"A" : "B"}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-11-03
@Samad_Samadovic

import json
A = json.loads(A)

S
schulz, 2021-11-03
@schulz

A = "{'A':'B'}"
eval(A)
>> {'A': 'B'}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question