I've been helping someone learn the language and he was having trouble
understanding why this didn't work:
test=open('testfile','w')
testread=test.readline()
I explained to him the problem, but I was wondering why Python doesn't raise
an exception when you do this. He probably wouldn't have had to ask me
anything if Python printed something like this:
IOError: [Errno X] You can't read from a file only open for writing.
understanding why this didn't work:
test=open('testfile','w')
testread=test.readline()
I explained to him the problem, but I was wondering why Python doesn't raise
an exception when you do this. He probably wouldn't have had to ask me
anything if Python printed something like this:
IOError: [Errno X] You can't read from a file only open for writing.