I have a big project called 'PyDOS' and it's going very well. I'm sort of stuck for ideas and I don't know any ideas. Post your answers of anything that could make it look cleaner - or new ideas I should add.
P.S It was written in Python 3.4.
import time
import os
import sys
import random
import operator
def textviewer():
os.system('cls' if os.name == 'nt' else 'clear')
print ("Text Viewer.")
file_name = input("Enter a text file to view: ")
file = open(file_name, "r")
print ("Loading text...")
time.sleep(4)
os.system('cls' if os.name == 'nt' else 'clear')
print(file.read())
input("Press enter to close")
def edit():
os.system('cls' if os.name == 'nt' else 'clear')
print ("EDIT")
print ("-------------")
print ("Note: Naming this current document the same as a different document will replace the other document with this one.")
filename = input("Plese enter a file name.")
file = open(filename, "w")
print ("FILE: " +filename+".")
line1 = input()
line2 = input()
line3 = input()
line4 = input()
line5 = input()
file.write(line1)
file.write("\n")
file.write(line2)
file.write("\n")
file.write(line3)
file.write("\n")
file.write(line4)
file.write("\n")
file.write(line5)
file.close()
print ("File successfully saved as: " +filename+"!")
time.sleep(3)
while True:
os.system('cls' if os.name == 'nt' else 'clear')
print ()
print ("PyDOS VERSION 1.5")
shell = input("> ")
if shell == "textviewer":
print ("Loading Text Viewer...")
time.sleep(3)
textviewer()
elif shell == "edit":
print ("Loading edit...")
time.sleep(3)
edit()
elif shell == "dir":
print ("The drive name is A:")
print ()
print ("NAME: TYPE: MODIFIED:")
print ("SHUTDOWN.EXE .EXE 12/01/15 ")
print ("EDIT.EXE .EXE 12/01/15 ")
print ("TEXTVIEWER.EXE .EXE 12/01/15 ")
elif shell == "cls":
os.system('cls' if os.name == 'nt' else 'clear')
elif shell == 'shutdown':
print ("Shutting down...")
time.sleep(3)
break
else:
print(""+ shell+ " is not a reconized command or external file.")
time.sleep(2)
os.system('cls' if os.name == 'nt' else 'clear')