@@ -1410,6 +1410,10 @@ msgid ""
14101410"terminated by the given string, and the line ending is returned to the "
14111411"caller untranslated."
14121412msgstr ""
1413+ "当从流中读取输入时,如果 *newline* 为 ``None``,则会启用 :term:`universal newlines` 模式。 "
1414+ "输入中的行结束符可以为 ``'\\ n'``, ``'\\ r'`` 或 ``'\\ r\\ n'``,在返回给调用者之前它们会被统一转写为 "
1415+ "``'\\ n'``。 如果参数为 ``''``,也会启用通用换行模式,但行结束符会不加转写即返回给调用者。 "
1416+ "如果它具有任何其他合法的值,则输入行将仅由给定的字符串结束,并且行结束符会不加转写即返回给调用者。"
14131417
14141418#: ../../library/io.rst:906
14151419msgid ""
@@ -1427,14 +1431,16 @@ msgstr ""
14271431msgid ""
14281432"If *line_buffering* is ``True``, :meth:`flush` is implied when a call to "
14291433"write contains a newline character or a carriage return."
1430- msgstr ""
1434+ msgstr "如果 *line_buffering* 为 ``True``,则当一个写入调用包含换行符或回车时将会应用 :meth:`flush`。 "
14311435
14321436#: ../../library/io.rst:915
14331437msgid ""
14341438"If *write_through* is ``True``, calls to :meth:`write` are guaranteed not to"
14351439" be buffered: any data written on the :class:`TextIOWrapper` object is "
14361440"immediately handled to its underlying binary *buffer*."
14371441msgstr ""
1442+ "如果 *write_through* 为 ``True``,对 :meth:`write` 的调用会确保不被缓冲:在 "
1443+ ":class:`TextIOWrapper` 对象上写入的任何数据会立即交给其下层的 *buffer* 来处理。"
14381444
14391445#: ../../library/io.rst:919
14401446msgid "The *write_through* argument has been added."
@@ -1447,50 +1453,56 @@ msgid ""
14471453"encoding using :func:`locale.setlocale`, use the current locale encoding "
14481454"instead of the user preferred encoding."
14491455msgstr ""
1456+ "默认的 *encoding* 现在将为 ``locale.getpreferredencoding(False)`` 而非 "
1457+ "``locale.getpreferredencoding()``。 不要使用 :func:`locale.setlocale` "
1458+ "来临时改变区域编码格式,要使用当前区域编码格式而不是用户的首选编码格式。"
14501459
14511460#: ../../library/io.rst:928
14521461msgid ""
14531462":class:`TextIOWrapper` provides these members in addition to those of "
14541463":class:`TextIOBase` and its parents:"
1455- msgstr ""
1464+ msgstr ":class:`TextIOWrapper` 在继承自 :class:`TextIOBase` 及其父类的现有成员以外还提供了下列成员: "
14561465
14571466#: ../../library/io.rst:933
14581467msgid "Whether line buffering is enabled."
14591468msgstr "是否启用行缓冲。"
14601469
14611470#: ../../library/io.rst:937
14621471msgid "Whether writes are passed immediately to the underlying binary buffer."
1463- msgstr ""
1472+ msgstr "写入是否要立即传给下层的二进制缓冲。 "
14641473
14651474#: ../../library/io.rst:945
14661475msgid ""
14671476"Reconfigure this text stream using new settings for *encoding*, *errors*, "
14681477"*newline*, *line_buffering* and *write_through*."
14691478msgstr ""
1479+ "使用 *encoding*, *errors*, *newline*, *line_buffering* 和 *write_through* "
1480+ "的新设置来重新配置此文本流。"
14701481
14711482#: ../../library/io.rst:948
14721483msgid ""
14731484"Parameters not specified keep current settings, except ``errors='strict'`` "
14741485"is used when *encoding* is specified but *errors* is not specified."
14751486msgstr ""
1487+ "未指定的形参将保留当前设定,例外情况是当指定了 *encoding* 但未指定 *errors* 时将会使用 ``errors='strict'``。"
14761488
14771489#: ../../library/io.rst:952
14781490msgid ""
14791491"It is not possible to change the encoding or newline if some data has "
14801492"already been read from the stream. On the other hand, changing encoding "
14811493"after write is possible."
1482- msgstr ""
1494+ msgstr "如果已经有数据从流中被读取则将无法再改变编码格式或行结束符。 另一方面,在写入数据之后再改变编码格式则是可以的。 "
14831495
14841496#: ../../library/io.rst:956
14851497msgid ""
14861498"This method does an implicit stream flush before setting the new parameters."
1487- msgstr ""
1499+ msgstr "此方法会在设置新的形参之前执行隐式的流刷新。 "
14881500
14891501#: ../../library/io.rst:964
14901502msgid ""
14911503"An in-memory stream for text I/O. The text buffer is discarded when the "
14921504":meth:`~IOBase.close` method is called."
1493- msgstr ""
1505+ msgstr "用于文本 I/O 的内存数据流。 当调用 :meth:`~IOBase.close` 方法时将会丢弃文本缓冲区。 "
14941506
14951507#: ../../library/io.rst:967
14961508msgid ""
@@ -1499,6 +1511,8 @@ msgid ""
14991511":meth:`~TextIOBase.write`. The stream is positioned at the start of the "
15001512"buffer."
15011513msgstr ""
1514+ "缓冲区的初始值可通过提供 *initial_value* 来设置。 如果启用了行结束符转写,换行将以 :meth:`~TextIOBase.write`"
1515+ " 所用的方式被编码。 数据流位置将被设为缓冲区的开头。"
15021516
15031517#: ../../library/io.rst:972
15041518msgid ""
@@ -1508,19 +1522,24 @@ msgid ""
15081522" as ``\\ n`` on all platforms, but universal newline decoding is still "
15091523"performed when reading."
15101524msgstr ""
1525+ "*newline* 参数的规则与 :class:`TextIOWrapper` 所用的一致。 默认规则是仅将 ``\\ n`` "
1526+ "字符视为行结束符并且不执行换行符转写。 如果 *newline* 设为 ``None``,在所有平台上换行符都将被写入为 "
1527+ "``\\ n``,但当读取时仍然会执行通用换行编码格式。"
15111528
15121529#: ../../library/io.rst:978
15131530msgid ""
15141531":class:`StringIO` provides this method in addition to those from "
15151532":class:`TextIOBase` and its parents:"
1516- msgstr ""
1533+ msgstr ":class:`StringIO` 在继承自 :class:`TextIOBase` 及其父类的现有成员以外还提供了以下方法: "
15171534
15181535#: ../../library/io.rst:983
15191536msgid ""
15201537"Return a ``str`` containing the entire contents of the buffer. Newlines are "
15211538"decoded as if by :meth:`~TextIOBase.read`, although the stream position is "
15221539"not changed."
15231540msgstr ""
1541+ "返回一个包含缓冲区全部内容的 ``str``。 换行符会以与 :meth:`~TextIOBase.read` "
1542+ "相同的方式被编码,但是流的位置不会被改变。"
15241543
15251544#: ../../library/io.rst:987
15261545msgid "Example usage::"
@@ -1531,6 +1550,8 @@ msgid ""
15311550"A helper codec that decodes newlines for :term:`universal newlines` mode. It"
15321551" inherits :class:`codecs.IncrementalDecoder`."
15331552msgstr ""
1553+ "用于在 :term:`universal newlines` 模式下解码换行符的辅助编解码器。 它继承自 "
1554+ ":class:`codecs.IncrementalDecoder`。"
15341555
15351556#: ../../library/io.rst:1014
15361557msgid "Performance"
0 commit comments