What does p stand for in "fp" of with open(filename, "w") as fp:

Question:

It might be extremely frivolous, but google searches are not helpful indeed.

In python official docs, it constantly refers file as fp:

with open(filename, "w") as fp:
fp.write() 

What’s does “p” stand for?

Asked By: AbstProcDo

||

Answers:

  1. It’s an entirely arbitrary name, but I think you understand that.
  2. It’s usually file pointer.
Answered By: deceze

"fp" stands for "file pointer" and it was a pointer to a FILE structure in C. The name "fp" just sort of stuck.

"fd" was an alternate and usually indicated an unsigned integer, which was the offset of the referenced file in the "file table" (file descriptor).

Answered By: LSerni
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.