def func1:
myfile = openthefile("hello.txt")
def openthefile(filename):
f = open(str(filename), 'r')
newdata = f.read
f.close()
return newdata
As shown above, I was trying to open a file in Python. What I don't understand is that even if I converted it to a string, I'm still having an error that says, "expected string or buffer". Is there something that I've done wrong here?
Will greatly appreciate your reply. Thanks
- Azhelle

New Topic/Question
Reply



MultiQuote





|