File Object Creation
These functions create new file objects:
-
fdopen(fd[,mode[,bufsize]]) Returns an open file object connected to the file descriptor
fd. Themodeandbufsizearguments have the same meaning as the corresponding arguments to the built-inopen()function. Availability: Macintosh, Unix, Windows.-
popen(command[,mode[,bufsize]]) Opens a pipe to or from
command. The return value is an open file object connected to the pipe, which can be read or written depending on whether mode isr(default) orw. Thebufsizeargument has the same meaning as the corresponding argument to the built-inopen()function. The exit status of the command (encoded in the format specified forwait()) is available as the return value of theclose()method of the file object, except that when the exit status is zero (termination without errors),Noneis returned. Availability: Unix, Windows.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access