Issue
I am making a program to read something from a group of files, but I get an EOF error.
def readMem(memId):
with open(memId, "r") as rf:
memVal = memId.read()
I get the error at the with open()
, (error persists even without the last line) but I cannot find out why. In my knowledge, there is no issue, I have even used this EXACT code in a different file.
Solution
You should call the read
method of the file object rf
instead:
def readMem(memId):
with open(memId, "r") as rf:
memVal = rf.read()
Answered By - blhsing Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.