Question
Computer Science Question on File Handling in Python
Which method moves a file pointer to the nth character with respect to r position?
A
fp.seek(r)
B
fp.seek(n)
C
fp.seek(n, r)
D
seek(n, r).fp
Answer
fp.seek(n, r)
Explanation
Solution
The seek(n, r) method moves the file pointer to the nth character relative to the reference position r (start, current, or end of file).