Hi there! Please sign in
help
tags
users
badges
ALL
UNANSWERED
Ask Your Question
Revision history [
back
]
1
initial version
answered
2022-02-14 12:00:00 +0000
devzero
51
●
1
●
4
●
4
Read the contents of the text file and store it in a variable.
Convert the string data into a Python list using the
ast.literal_eval()
method.
Convert the list into a JSON format using the
json.dumps()
method.
Write the JSON data to a new file or overwrite the existing one if desired.
Copyright QStack.ai, 2010-2023. Content on this site is licensed under the Creative Commons Attribution Share Alike 3.0 license.
Please note: QStack requires javascript to work properly, please enable javascript in your browser,
here is how