Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Jean-Michel Pichavant
Cathy James wrote: f = open ('c:/testing.txt'', 'r') replace the double quote by a single quote. JM -- http://mail.python.org/mailman/listinfo/python-list

Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Chris Rebert
On Tue, May 24, 2011 at 1:31 AM, Cathy James wrote: > dear mentor, > > I need help with my code: In addition to what others have already said... > please see my attempt below and help: > > #1) open file and display current file contents: > f = open ('c:/testing.txt'', 'r') > f.readlines() > #2)

Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Chris Angelico
On Tue, May 24, 2011 at 6:31 PM, Cathy James wrote: >     s = input ('enter name: ').strip() Are you using Python 2 or Python 3? If it's Python 2, this should be raw_input(). >     f = open ('c:/testing.txt', 'a') > ... >     f = open ('c:/testing.txt', 'r') You may be having trouble here a

Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Tim Golden
On 24/05/2011 09:31, Cathy James wrote: dear mentor, I need help with my code: 1) my program won't display file contents upon opening #1) open file and display current file contents: f = open ('c:/testing.txt'', 'r') f.readlines() If you're running this in an interactive interpreter, I would

NEED HELP- read file contents, while loop to accept user input, and enter to exit

2011-05-24 Thread Cathy James
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 fil