Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #WARNING: Requires Minimum Techcore V.1.1.0
- import sys , os , time , techcore
- def saveFile(text , path) :
- text = text[1:]
- file = open(path , "w")
- file.write(text)
- file.close()
- def readFile(path) :
- if not os.path.isfile(path) :
- filec = open(path , "w")
- filec.write("")
- filec.close
- file = open(path , "r")
- text = file.read()
- file.close()
- return text
- menu = """===================
- | PyText V.1.0.0 |
- | by MRtecno98 |
- ===================
- """
- print(menu , end='')
- time.sleep(1)
- print()
- while True :
- try :
- txtList = []
- files = os.listdir()
- maxLen = 0
- for x in files :
- if x[-4:] == ".txt" :
- txtList.append(x)
- if len(x) + 3 > maxLen :
- maxLen = len(x) + 3
- techcore.createTable("Files",txtList,"=","|",maxLen,0.5)
- path = input("Inserisci il percorso del file, E per uscire: ")
- if path.lower() == "e" :
- print("Uscendo...")
- time.sleep(3)
- sys.exit()
- if not path[-4:] == ".txt" :
- path = path + ".txt"
- #while True :
- # path = input("Inserisci il percorso del file: ")
- # if os.path.ispath(path) :
- # break
- # else :
- # print("Path non valido")
- text = readFile(path)
- print("File Caricato!")
- print("Per modificare il testo scrivi e premi invio per ogni riga,\nUsa |back| per cancellare una riga,\nUsa |end| per terminare la scrittura.")
- newText = techcore.editText(text , "|end|" , "|back|")
- saveFile(newText , path)
- print("\nFile Salvato!")
- time.sleep(3)
- continue
- except KeyboardInterrupt :
- print("\nProgramma Terminato!")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement