add json_to_txt converter
This commit is contained in:
1 parent
1e959f53b0
commit
b31adcf66b
1 file changed
+24
@@ -0,0 +1,24 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
with open("thread_posts.json") as f:
|
||||||
|
posts = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
posts_txt = []
|
||||||
|
|
||||||
|
for post in posts:
|
||||||
|
single_txt = f"""{post['author']} schrieb um {post['timestamp']}:
|
||||||
|
|
||||||
|
{post['text']}"""
|
||||||
|
|
||||||
|
posts_txt.append(single_txt)
|
||||||
|
|
||||||
|
|
||||||
|
all_posts = """
|
||||||
|
|
||||||
|
##########
|
||||||
|
|
||||||
|
""".join(posts_txt)
|
||||||
|
|
||||||
|
print(all_posts)
|
||||||
Reference in new issue
Block a user