I have read the "seek" function documentation and I know there are as arguments an offset and a whence argument. I can use this function perfectly when only using the offset argument, but if I specify the whence argument, "seek" only works if the offset is 0. If not, this is what happens:
f = open ('New_file.txt', 'w')
f.write ('This is a text')
f.seek (-5, 2)
Error:
--------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-1-d369dbea9034> in <module>()
1 f = open ('New_file.txt', 'w')
2 f.write ('This is a text')
----> 3 f.seek (-5, 2)
UnsupportedOperation: can't do nonzero end-relative seeks`
I have used help (f.seek)
and it says I can use negative numbers in the offset, so can somebody tell me why I have this problem?