Computer Science, asked by rajakhimanshu94, 6 months ago

Write a program in Python using function named Create(str) which takes a string as

argument and returns a dictionary by creating from that string as per follow​

Answers

Answered by Anonymous
6

Answer:

you can simply use a = eval(a) to get a as object of dictionary from a string object.

...

It does 3 things:

split the string into "<key> - <value>" parts: s. split(',')

split each part into "<key> ", " <value>" pairs: item. split('-')

remove the whitespace from each pair: (k. strip(), v. strip())

Similar questions