Transforming Python Dictionaries From Data Structures to Strings with pprint

PHOTO EMBED

Wed May 22 2024 15:22:42 GMT+0000 (Coordinated Universal Time)

Saved by @freepythoncode ##python #coding #python #programming #dict #convert

import pprint

data = {'email': 'test@test.com', 'password': '123'}

print(data, type(data))

# convert dict to str
result = pprint.pformat(data)

print(result, type(result))
content_copyCOPY