Skip to main content

File

Standard library class internal.file.File View source
class File
@tuple
class File[T]
Fields 1
T type
Constructors 3
__new__
__new__[mode: Literal[str]](fp: cobj)
Defined in internal.file
__new__
__new__(path: str, mode: str, encoding: str = "utf-8", errors: str = "strict", newline: Optional[str] = None)
Defined in internal.file
__new__
__new__(fd: int, mode: str)
Defined in internal.file
Methods 9
readlines
readlines(self: Self, /) -> List[T]
Defined in internal.file
readline
readline(self: Self, /) -> T
Defined in internal.file
write
write(self: Self, s: T, /) -> int
Defined in internal.file
read
@inline
read(self: Self, sz: int = -1, /) -> T
Defined in internal.file
tell
tell(self: Self, /) -> int
Defined in internal.file
seekable
seekable(self: Self, /) -> bool
Defined in internal.file
seek
seek(self: Self, offset: int, whence: int, /)
Defined in internal.file
flush
flush(self: Self, /)
Defined in internal.file
close
close(self: Self, /)
Defined in internal.file
Special methods 4
__enter__
__enter__(self: Self, /)
Defined in internal.file
__exit__
__exit__(self: Self, /)
Defined in internal.file
__iter__
__iter__(self: Self, /) -> Generator[T]
Defined in internal.file
__file_write_gen__
__file_write_gen__[T: type](self: Self, g: Generator[T])
Defined in internal.file