On Friday 17 June 2011 17:42:29 Walter Prins wrote:
> On 17 June 2011 17:20, Lisi wrote:
> > >>> file=open("/home/lisi/CHOOSING_SHOES.txt", "r")
> > >>> file.close()
> > >>> file=open("/home/lisi/CHOOSING_SHOES.txt", "r")
> > >>> whole=file.read
> > >>> print whole
> >
> >
> >
> > >>> print "%r"
Your problem is right here:
>>> whole=file.read
>>> print whole
Your re-assigning the method "read()", which is a method of the object
"file" to the variable "whole"
So, when you print "whole" you can see that it is printing the location of
the method in memory. If you were to print file.read yo
On 17 June 2011 17:20, Lisi wrote:
> >>> file=open("/home/lisi/CHOOSING_SHOES.txt", "r")
> >>> file.close()
> >>> file=open("/home/lisi/CHOOSING_SHOES.txt", "r")
> >>> whole=file.read
> >>> print whole
>
> >>> print "%r" % whole
>
> >>> print "whole is %r" %whole
> whole is
> >>> print "whole
So sorry to have troubled you all. The light suddenly dawned. Perhaps
because I was more relaxed, having asked the list? Anyhow, I now know how to
do it, and it is of course, simple. [Passing on and coming back would
obviously have worked, but the author had said not to do that this
time. :
Hello :-)
I have got as far as I have,i.e. apparently succeeding in both opening and
closing two different files, thanks to google, but my struggles to _do_
something with a file that I have opened are getting me nowhere. Here is my
latest failure:
>>> file=open("/home/lisi/CHOOSING_SHOES.txt