I was giving input in double quotes, after processing some operations need to display output in double quotes where its giving in single quote format
code:
def movie_data(movie_list):
mve = {}
for k, v in movie_list.items():
if type(v) == str:
mve[k] = str(v) if v else None
elif type(v) == dict:
mve[k] = movie_data(v)
else:
pass
return mve
movie_list = {"name":"Marvel","movies": {"spiderman":"Tom","Thor":"Chris"},"Review":"5star"}
movie_data(movie_list)
Output:
{'name': 'Marvel', 'movies': {'spiderman': 'Tom', 'Thor': 'Chris'}, 'Review': '5star'}
Expected Output:
{"name":"Marvel","movies": {"spiderman":"Tom","Thor":"Chris"},"Review":"5star"}