Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import calendar
- import os
- # print(time.time())
- #
- # print(time.ctime(time.time()))
- #
- # strVreme=time.strftime("%Y.%m.%d %H:%M:%S %j", time.gmtime(time.time()))
- #
- # print(strVreme)
- #
- # c=calendar.calendar(2019)
- #
- #
- # mesec=calendar.month(2019,3)
- #
- # time.sleep(5)
- #
- #
- # print(mesec)
- if not os.path.exists("dir1/dir2"):
- os.mkdir("dir1/dir2")
- print (os.listdir("dir1"))
- os.rmdir("dir1/dir2")
- f=open("dir1/dat1.txt", "a+")
- f.write("Neki Strngic bby\n")
- #f=open("dir1/dat1.txt", "ab+")
- #f.write(b"Neki Strngic bby\n") binarno
- print (f.tell())
- f.seek(0,0) #druga vrednost odakle krece pomeraj, 0 od pochetka, 1 od trenuttne pozicije, 2 od kraja dokumenta
- sadrzaj=f.read() #vrednost u zagradi znachi koliko chita, bez parametra - koliko moze
- #sadrzaj=f.readline() chita liniju, i svaki sledeci poziv prebacuje u sledecu liniju
- #sadrzaj=f.readlines() vraca ceo sadrzaj kao listu
- print(sadrzaj)
- #print(sadrzaj.decode("UTF-8")) za binarno
- f.flush()
- f.close
- ----------------------------------------------------------------------
- import os
- meni=input("1- Unos nove arhive \n\n2- Unos novog zapisnika \n\n3- Unos sadrzaja u zapisnik \n\n4- Dodaj sadrzaj u zapisnik \n\n5- Izlistaj sve zapisnike \n\n6- Prikazi zapisnik \n\n7- Obrisi zapisnik \n\n8- Izlaz\n\n")
- if meni=="1":
- novaArhiva=input("Unesite ime nove arhive: ")
- if not os.path.exists("arhive/" + novaArhiva):
- os.mkdir("arhive/" + novaArhiva)
- if not os.path.exists("arhive/"+novaArhiva):
- print("Arhiva nije kreirana")
- else:
- print("Arhiva kreirana")
- if meni=="2":
- novaArhiva = input("Unesite ime arhive: ")
- noviZapisnik=input("Unesite ime novog zapisnika: ")
- if not os.path.exists("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt"):
- f=open("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt", "w+")
- if not os.path.exists("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt"):
- print("Zapisnik nije kreiran")
- else:
- print("Zapisnik kreiran")
- f.flush()
- f.close
- if meni=="3":
- lista=os.walk("arhive")
- print(lista)
- noviZapisnik = input("Unesite ime zapisnika: ")
- if not os.path.exists("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt"):
- print("Zapisnik nepostoji")
- else:
- f=open("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt", "w+")
- unosTexta=input("Unesite text zapisnika: ")
- f.write("\n" + unosTexta)
- if meni=="4":
- novaArhiva = input("Unesite ime arhive: SREDI PRONALAZENJE SAMO PO IMENU")
- noviZapisnik = input("Unesite ime zapisnika: ")
- if not os.path.exists("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt"):
- print("Zapisnik nepostoji")
- else:
- f = open("arhive/" + novaArhiva + "/" + noviZapisnik + ".txt", "w+")
- unosTexta = input("Unesite text zapisnika: ")
- f.write("\n" + unosTexta)
- if meni=="5":
- x=0
- if meni=="6":
- x=0
- if meni=="7":
- x = 0
- if meni=="8":
- x=0
Add Comment
Please, Sign In to add comment