Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual meaning of what it does, any explanations are much appreciated, thank you.
Please excuse my confusion here but I have read the documentation regarding the seek()
Share
Regarding
seek()there’s not too much to worry about.First of all, it is useful when operating over an open file.
It’s important to note that its syntax is as follows:
where
fpis the file pointer you’re working with;offsetmeans how many positions you will move;from_whatdefines your point of reference:if omitted,
from_whatdefaults to 0.Never forget that when managing files, there’ll always be a position inside that file where you are currently working on. When just open, that position is the beginning of the file, but as you work with it, you may advance.
seekwill be useful to you when you need towalkalong that open file, just as a path you are traveling into.