Computer Science
Which statement is used to change the file position to an offset value from the start?
- fp.seek(offset, 0)
- fp.seek(offset, 1)
- fp.seek(offset, 2)
- None of these
Python Data Handling
2 Likes
Answer
fp.seek(offset, 0)
Reason — The syntax for relative referencing is f.seek(offset, from_what)
. The statement f.seek(offset, 0)
is used to change the file position to an offset value from the start, where 0 sets the reference point at the beginning of the file.
Answered By
2 Likes
Related Questions
In file handling, what do the terms "r" and "a" stand for?
- read, append
- append, read
- write, append
- None of these
Which of the following is not a valid mode to open a file ?
- ab
- rw
- r+
- w+
The difference between r+ and w+ modes is expressed as?
- No difference
- In r+ mode, the pointer is initially placed at the beginning of the file and the pointer is at the end for w+
- In w+ mode, the pointer is initially placed at the beginning of the file and the pointer is at the end for r+
- Depends on the operating system
What does CSV stand for?
- Cursor Separated Variables
- Comma Separated Values
- Cursor Separated Values
- Cursor Separated Version