I need to make a command-line textual content editor in python. Is that this good code?
from termcolor import * import os whereas True: information = os.listdir() bufname = enter("File title: ") title = cprint("Ganesha Editor v1.0", "inexperienced") controls = cprint("Sort $exit to exit textual content editor. It autosaves.", "blue") def write(): print("Compose One thing Beneath:nn") textual content = enter() if textual content == "$exit": exit() else: if bufname in information: os.take away(bufname) create = open(bufname, "w") create.shut() autosave = open(bufname, "a") autosave.write(textual content) autosave.write("n") autosave.shut() else: autosave = open(bufname, "a") autosave.write(textual content) autosave.write("n") autosave.shut() whereas True: write()
I prettified the code with eight areas for the indents.
Does anybody like this code? It’s extremely minimal, and nobody will prefer it, however, I am attempting to make a secondary text-editor.