mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Added more file-handling related cross-references.
This commit is contained in:
parent
f7601ee2c0
commit
ac3d429edc
4 changed files with 15 additions and 5 deletions
|
@ -766,8 +766,9 @@ available. They are listed here in alphabetical order.
|
||||||
Python enforces that the mode, after stripping ``'U'``, begins with ``'r'``,
|
Python enforces that the mode, after stripping ``'U'``, begins with ``'r'``,
|
||||||
``'w'`` or ``'a'``.
|
``'w'`` or ``'a'``.
|
||||||
|
|
||||||
See also the :mod:`fileinput` module, the :mod:`os` module, and the
|
Python provides many file handling modules including
|
||||||
:mod:`os.path` module.
|
:mod:`fileinput`, :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and
|
||||||
|
:mod:`shutil`.
|
||||||
|
|
||||||
.. versionchanged:: 2.5
|
.. versionchanged:: 2.5
|
||||||
Restriction on first letter of mode string introduced.
|
Restriction on first letter of mode string introduced.
|
||||||
|
|
|
@ -11,7 +11,9 @@ functionality than importing a operating system dependent built-in module like
|
||||||
:mod:`posix` or :mod:`nt`. If you just want to read or write a file see
|
:mod:`posix` or :mod:`nt`. If you just want to read or write a file see
|
||||||
:func:`open`, if you want to manipulate paths, see the :mod:`os.path`
|
:func:`open`, if you want to manipulate paths, see the :mod:`os.path`
|
||||||
module, and if you want to read all the lines in all the files on the
|
module, and if you want to read all the lines in all the files on the
|
||||||
command line see the :mod:`fileinput` module.
|
command line see the :mod:`fileinput` module. For creating temporary
|
||||||
|
files and directories see the :mod:`tempfile` module, and for high-level
|
||||||
|
file and directory handling see the :mod:`shutil` module.
|
||||||
|
|
||||||
This module searches for an operating system dependent built-in module like
|
This module searches for an operating system dependent built-in module like
|
||||||
:mod:`mac` or :mod:`posix` and exports the same functions and data as found
|
:mod:`mac` or :mod:`posix` and exports the same functions and data as found
|
||||||
|
@ -983,6 +985,9 @@ Files and Directories
|
||||||
``0777`` (octal). On some systems, *mode* is ignored. Where it is used, the
|
``0777`` (octal). On some systems, *mode* is ignored. Where it is used, the
|
||||||
current umask value is first masked out. Availability: Macintosh, Unix, Windows.
|
current umask value is first masked out. Availability: Macintosh, Unix, Windows.
|
||||||
|
|
||||||
|
It is also possible to create temporary directories; see the
|
||||||
|
:mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
|
||||||
|
|
||||||
|
|
||||||
.. function:: makedirs(path[, mode])
|
.. function:: makedirs(path[, mode])
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
|
|
||||||
The :mod:`shutil` module offers a number of high-level operations on files and
|
The :mod:`shutil` module offers a number of high-level operations on files and
|
||||||
collections of files. In particular, functions are provided which support file
|
collections of files. In particular, functions are provided which support file
|
||||||
copying and removal.
|
copying and removal. For operations on individual files, see also the
|
||||||
|
:mod:`os` module.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
|
@ -1846,7 +1846,10 @@ created with the built-in :func:`file` and (more usually) :func:`open`
|
||||||
constructors described in the :ref:`built-in-funcs` section. [#]_ File
|
constructors described in the :ref:`built-in-funcs` section. [#]_ File
|
||||||
objects are also returned by some other built-in functions and methods,
|
objects are also returned by some other built-in functions and methods,
|
||||||
such as :func:`os.popen` and :func:`os.fdopen` and the :meth:`makefile`
|
such as :func:`os.popen` and :func:`os.fdopen` and the :meth:`makefile`
|
||||||
method of socket objects.
|
method of socket objects. Temporary files can be created using the
|
||||||
|
:mod:`tempfile` module, and high-level file operations such as copying,
|
||||||
|
moving, and deleting files and directories can be achieved with the
|
||||||
|
:mod:`shutil` module.
|
||||||
|
|
||||||
When a file operation fails for an I/O-related reason, the exception
|
When a file operation fails for an I/O-related reason, the exception
|
||||||
:exc:`IOError` is raised. This includes situations where the operation is not
|
:exc:`IOError` is raised. This includes situations where the operation is not
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue