Re: noob: print and file.read()

2012-12-03 Thread Andrew Z
Mrab, you nailed it. thank you very much! AZ -- http://mail.python.org/mailman/listinfo/python-list

Re: noob: print and file.read()

2012-12-03 Thread MRAB
On 2012-12-03 23:06, Andrew Z wrote: Hello, why the following code doesn't print the content of the file: #!/usr/bin/python from_file ="file.txt" in_file = open(from_file) str = in_file.read() You've read the entire file, leaving the file pointer positioned at the end of the file. print "H

noob: print and file.read()

2012-12-03 Thread Andrew Z
Hello, why the following code doesn't print the content of the file: #!/usr/bin/python from_file ="file.txt" in_file = open(from_file) str = in_file.read() print "Here should be the output from the file - ", in_file.read() print "Here should be the output from the STR- ", str in_file.close() Th