closefunktion klammern vergessen - list funktion erweitern
This commit is contained in:
parent
ca01baeb4c
commit
46c444990e
4 changed files with 13 additions and 4 deletions
14
notizen/n.py
14
notizen/n.py
|
@ -22,12 +22,18 @@ def crypt(text, key_hash):
|
|||
def o(note,mode):
|
||||
return open(f"{n_path}{note}.txt",mode,encoding="utf-8")
|
||||
def nlist():
|
||||
notizen = []
|
||||
if os.listdir(n_path) == []:
|
||||
print("Noch keine Notizen")
|
||||
else:
|
||||
print("Deine Notizen:")
|
||||
for a in os.listdir(n_path):
|
||||
print(f" - {a}"[:-4])
|
||||
notizen.append(f"{a}"[:-4])
|
||||
for n in notizen:
|
||||
print(f" - {n}:")
|
||||
datei = o(n,"r")
|
||||
print(crypt(datei.read() ,passwort))
|
||||
datei.close()
|
||||
|
||||
## variablen
|
||||
passwort = input("Passwort:")
|
||||
|
@ -91,14 +97,14 @@ ACHTUNG: Es kann seine Das einige Zeichen wie Umlaute falsch
|
|||
datei = o(a_note,"w")
|
||||
text = input("bitte neuen Text einfügen:")
|
||||
datei.write(crypt(text, passwort))
|
||||
datei.close
|
||||
datei.close()
|
||||
print("Erfolgreich gespeichert")
|
||||
if action == "read": #read
|
||||
a_note = input("Notiz Titel:")
|
||||
if a_note+".txt" in os.listdir(n_path):
|
||||
datei = o(a_note,"r")
|
||||
print(crypt(datei.read() ,passwort))
|
||||
datei.close
|
||||
datei.close()
|
||||
else:
|
||||
print("Notiz gibts nicht.")
|
||||
if action == "add": #add
|
||||
|
@ -109,7 +115,7 @@ ACHTUNG: Es kann seine Das einige Zeichen wie Umlaute falsch
|
|||
datei = o(a_note,"w")
|
||||
text = input("bitte neuen Text einfügen:")
|
||||
datei.write(crypt(text , passwort))
|
||||
datei.close
|
||||
datei.close()
|
||||
print("Erfolgreich gespeichert")
|
||||
if action == "delete": #delete
|
||||
a_note = input("Notiz Titel:")
|
||||
|
|
2
notizen/n/banane.txt
Normal file
2
notizen/n/banane.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
^S
|
||||
QT^R
WZ
|
1
notizen/n/dodel.txt
Normal file
1
notizen/n/dodel.txt
Normal file
|
@ -0,0 +1 @@
|
|||
ZQXZYZYW
|
BIN
notizen/n/wurst.txt
Normal file
BIN
notizen/n/wurst.txt
Normal file
Binary file not shown.
Loading…
Reference in a new issue