I've got a syntax error when defining this function.
def questionfilehandler("filename.txt"):
with open("filename.txt", "r") as file:
print(file.read)
return input()
file.close()
I've looked up the syntax, and it all appears to be correct.
This is the error message I got
And this is the code with the error highlighted by IDLE.
Thanks to everyone who reads and tries to answer this. Your time is greatly appreciated =).
with open(my_file ...you don't need to callmy_file.close()at the end. It's automatically handled by thewithstatement!