dear mentor,
I need help with my code:
1) my program won't display file contents upon opening
2) my program is not writing to file
3) my program is not closing when user presses enter- gow do I do this with
a while loop?
please see my attempt below and help:
#1) open file and display current file contents:
f = open ('c:/testing.txt'', 'r')
f.readlines()
#2) and 3) use while loop to write user input to file, save to file, close
when press enter:
while True:
s = input ('enter name: ').strip()
f = open ('c:/testing.txt', 'a')
if f.writable():
f.write(s)
break
else:
f = open ('c:/testing.txt', 'r')
f.readlines()
for line in f:
print (line)
--
http://mail.python.org/mailman/listinfo/python-list