21 lines
651 B
Python
Executable File
21 lines
651 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import shelve
|
|
# schreibe shelve Wird dauerhaft gespeichert
|
|
spieler_endrunde = ["Hans", "Daniel"]
|
|
with shelve.open("testfile") as inhalt:
|
|
inhalt["imFinale"] = spieler_endrunde
|
|
# inhalt["Vorrunde"] = [spieler_endrunde, "Klaus", "Martin"]
|
|
#
|
|
#with shelve.open("testfile") as inhalt:
|
|
# print(inhalt["imFinale"])
|
|
# erweitere Shelve mit neuer Liste
|
|
with shelve.open("testfile") as inhalt:
|
|
new_value = inhalt["imFinale"]
|
|
new_value.append("derNeue3")
|
|
#inhalt["imFinale"] = new_value
|
|
print(list(inhalt.keys()))
|
|
|
|
|
|
#with*1 open('Textdatei.txt', 'w') as inhalt*2:
|
|
#*3inhalt.write('Hallo Schrödinger!') |