Python's built-in file objects are implemented entirely on the FILE* support from the C standard library. This is an implementation detail and may change in future releases of Python.
file
and
types.FileType
.
PyObject *p) |
PyObject *p) |
char *filename, char *mode) |
FILE *fp, char *name, char *mode, int (*close)(FILE*)) |
PyObject *p) |
PyObject *p, int n) |
p.readline([n])
, this
function reads one line from the object p. p may be a
file object or any object with a readline() method. If
n is 0
, exactly one line is read, regardless of the
length of the line. If n is greater than 0
, no more
than n bytes will be read from the file; a partial line can be
returned. In both cases, an empty string is returned if the end of
the file is reached immediately. If n is less than 0
,
however, one line is read regardless of length, but
EOFError is raised if the end of the file is reached
immediately.
PyObject *p) |
PyFileObject *p, int n) |
PyFileObject *p, const char *enc) |
PyObject *p, int newflag) |
0
as the previous
value if the attribute either does not exist or if there were errors
in retrieving it. There is no way to detect errors from this
function, but doing so should not be needed.
PyObject *obj, PyObject *p, int flags) |
0
on success or -1
on
failure; the appropriate exception will be set.
const char *s, PyObject *p) |
0
on
success or -1
on failure; the appropriate exception will be
set.
See About this document... for information on suggesting changes.