Asking for Help: Why when I read a text file python reads it as
"<built-in method read of _io.TextIOWrapper object at
0x02954558>" and how do I stop this? I am writing a program that
uses text files to store user information like their name and
password. I am using this information to check login info
against the info they have provided. This never worked so I
decided to do a simple open files program to find the problem.
and when I ran it on Idle it printed: <built-in method read of
_io.TextIOWrapper object at 0x02954558> Instead of what I had in
my text file. Does anyone know why this is happening or how to
stop it? You have to actually call the read method as follows: a
= f.read() The brackets are important because they tell Python
to actually call the method, and this produces the content of
the file to be assigned to a. If you don't have the brackets,
all you are doing is obtaining the read method and assigning it
to a. Thus, when you print a you see a piece of text describing
the method (which is what <