This commit is contained in:
marcus 2022-03-24 10:44:46 +01:00
commit 0a80bbc6ae
2 changed files with 25 additions and 0 deletions

14
json_writer.py Normal file
View File

@ -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)

11
regex_beispiel.py Normal file
View File

@ -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)