Skip to main contentSkip to solution

Which function returns an integer that specifies the current position of the file object in the file?

Solution

✅ Correct Option: 2

The tell() method returns an integer giving the current position of the file pointer, measured in bytes from the start of the file. For example, f.tell() returns 0 right after a file is opened in read mode.


seek(): this is the confusable one. It moves the file pointer to a given position and does not report the current position.

read(): returns the file's content (a string or bytes), not a position.

Remember: tell() "tells" where you are, and seek() "seeks" a new place to go.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question