Created
July 14, 2021 11:24
-
-
Save hamaguchi-amago/52a5cabed3b0f9fd83cf1d503a3e7cf9 to your computer and use it in GitHub Desktop.
【Python】dictからstrへの変換・strからdictへの変換 【Python】dictからstrへの変換・strからdictへの変換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
dict_data = {"key1": "data1", | |
"key2": "data2", | |
"key3": "data3"} | |
print(dict_data) | |
print(type(dict_data)) | |
str_data = json.dumps(dict_data) | |
print(str_data) | |
print(type(str_data)) | |
re_conversion_data = json.loads(str_data) | |
print(re_conversion_data) | |
print(type(re_conversion_data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ブログの記事で作成しました。
興味のある方はご覧ください。
【Python】dictからstrへの変換・strからdictへの変換
https://neko-py.com/python-dict-to-str