@@ -2294,9 +2294,9 @@ msgid ""
22942294"filenames returned will also be of type ``bytes``; in all other "
22952295"circumstances, they will be of type ``str``."
22962296msgstr ""
2297- "*path* 可以是 :term:`路径类对象 <path-like object>`。如果 *path* 是(直接/间接由 "
2298- ":class:`PathLike` 接口返回的) ``bytes`` 类型,则返回的文件名也将是 ``bytes`` 类型,其他情况下文件名类型是 "
2299- "``str`` 。"
2297+ "*path* 可以是 :term:`类路径对象 <path-like object>`。如果 *path* 是(直接/间接由 "
2298+ ":class:`PathLike` 接口返回的)``bytes`` 类型,则返回的文件名也将是 ``bytes`` 类型,其他情况下是 ``str`` "
2299+ "类型 。"
23002300
23012301#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:1809
23022302#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2210
@@ -2727,11 +2727,13 @@ msgid ""
27272727"respectively. In order to remove whole directory trees, "
27282728":func:`shutil.rmtree` can be used."
27292729msgstr ""
2730+ "移除(删除)目录 *path*。如果目录不存在或不为空,则会分别抛出 :exc:`FileNotFoundError` 或 :exc:`OSError`"
2731+ " 异常。要删除整个目录树,可以使用 :func:`shutil.rmtree`。"
27302732
27312733#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2180
27322734#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2875
27332735msgid "The *dir_fd* parameter."
2734- msgstr ""
2736+ msgstr "*dir_fd* 参数。 "
27352737
27362738#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2189
27372739msgid ""
@@ -2740,6 +2742,8 @@ msgid ""
27402742"arbitrary order, and the special entries ``'.'`` and ``'..'`` are not "
27412743"included."
27422744msgstr ""
2745+ "返回一个迭代出 :class:`os.DirEntry` 对象的迭代器,这些对象对应于 *path* 目录中的条目。条目的生成顺序是任意的,特殊条目 "
2746+ "``'.'`` 和 ``'..'`` 不包括在内。"
27432747
27442748#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2194
27452749msgid ""
@@ -2753,6 +2757,11 @@ msgid ""
27532757"requires a system call on Unix but only requires one for symbolic links on "
27542758"Windows."
27552759msgstr ""
2760+ "如果需要文件类型或文件属性信息,使用 :func:`scandir` 代替 :func:`listdir` "
2761+ "可以大大提高这部分代码的性能,因为如果操作系统在扫描目录时返回的是 :class:`os.DirEntry` 对象,则该对象包含了这些信息。所有 "
2762+ ":class:`os.DirEntry` 的方法都可能执行一次系统调用,但是 :func:`~os.DirEntry.is_dir` 和 "
2763+ ":func:`~os.DirEntry.is_file` 通常只在有符号链接时才执行一次系统调用。:func:`os.DirEntry.stat` 在 "
2764+ "Unix 上始终需要一次系统调用,而在 Windows 上只在有符号链接时才需要。"
27562765
27572766#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2204
27582767msgid ""
@@ -2762,6 +2771,10 @@ msgid ""
27622771" each :class:`os.DirEntry` will be ``bytes``; in all other circumstances, "
27632772"they will be of type ``str``."
27642773msgstr ""
2774+ "*path* 可以是 :term:`类路径对象 <path-like object>`。如果 *path* 是(直接/间接由 "
2775+ ":class:`PathLike` 接口返回的)``bytes`` 类型,那么每个 :class:`os.DirEntry` 的 "
2776+ ":attr:`~os.DirEntry.name` 和 :attr:`~os.DirEntry.path` 属性将是 ``bytes`` "
2777+ "类型,其他情况下是 ``str`` 类型。"
27652778
27662779#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2214
27672780msgid ""
@@ -2773,11 +2786,11 @@ msgstr "引发一个 :ref:`审计事件 <auditing>` ``os.scandir``,附带参
27732786msgid ""
27742787"The :func:`scandir` iterator supports the :term:`context manager` protocol "
27752788"and has the following method:"
2776- msgstr ""
2789+ msgstr ":func:`scandir` 迭代器支持 :term:`上下文管理 <context manager>` 协议,并具有以下方法: "
27772790
27782791#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2220
27792792msgid "Close the iterator and free acquired resources."
2780- msgstr ""
2793+ msgstr "关闭迭代器并释放占用的资源。 "
27812794
27822795#: /home/travis/build/python/cpython-doc-catalog/Doc/library/os.rst:2222
27832796msgid ""
0 commit comments