Code:
def menu():
print "1) New Document"
print "2) Open Existing Document"
d=int(raw_input("What do you want to do?: "))
if d == 1:
new()
elif d == 2:
existing()
def new():
doc = raw_input("What do you want to call you text file?: ")
a=open("%s.txt" % doc, 'w')
q = []
qn = []
while True:
q.append(raw_input(""))
if '!done' in q:
qn = q[:-1]
c = "\n".join(qn)
a.write(c)
a.write('\n')
a.close()
print "saved!"
menu()
def existing():
doc = raw_input("What text document do you want to open?: ")
a=open("%s.txt" % doc, 'r')
for line in a:
print line
a=open("%s.txt" % doc, 'a')
q = []
qn = []
while True:
q.append(raw_input(""))
if '!done' in q:
qn = q[:-1]
c = "\n".join(qn)
a.write(c)
a.write('\n')
a.close()
print "saved!"
menu()
menu()
I realize this isn't fully functional, I really just put this out there for people to learn from.