init
This commit is contained in:
commit
0a80bbc6ae
14
json_writer.py
Normal file
14
json_writer.py
Normal 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
11
regex_beispiel.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user