commit 0a80bbc6ae727dad7c9eea51a158cdb06c608e31 Author: marcus Date: Thu Mar 24 10:44:46 2022 +0100 init 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