From 0a80bbc6ae727dad7c9eea51a158cdb06c608e31 Mon Sep 17 00:00:00 2001 From: marcus Date: Thu, 24 Mar 2022 10:44:46 +0100 Subject: [PATCH] init --- json_writer.py | 14 ++++++++++++++ regex_beispiel.py | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 json_writer.py create mode 100644 regex_beispiel.py diff --git a/json_writer.py b/json_writer.py new file mode 100644 index 0000000..cfae977 --- /dev/null +++ b/json_writer.py @@ -0,0 +1,14 @@ +import json + +# Fill my Json File with object from 0 to 299 +counter = 0 +data = [{counter: {'question': '', 'answer': ''}}] + +while counter < 300: + data.append({counter: {'question': '', 'answer': ''}}) + counter += 1 +print(data) + +json_string = json.dumps(data) +with open('jsontest.json', 'w') as file: + file.write(json_string) diff --git a/regex_beispiel.py b/regex_beispiel.py new file mode 100644 index 0000000..83ae4f6 --- /dev/null +++ b/regex_beispiel.py @@ -0,0 +1,11 @@ +import re + + +# Beispiel String +test_string = '(Beispiel), Text, ohne Kommas' + +# Patterns in der eckigen Klammer angeben +test_string_formatiert = re.sub('[,()]', '', test_string) + +# Ausgabe +print(test_string_formatiert) \ No newline at end of file