@@ -201,7 +201,7 @@ msgstr "关闭序列。"
201201msgid ""
202202"The class which implements the sequence behavior provided by the module is "
203203"available for subclassing as well:"
204- msgstr ""
204+ msgstr "此模块所提供的实现了序列行为的类同样也可用于子类化: "
205205
206206#: ../../library/fileinput.rst:142
207207msgid ""
@@ -214,38 +214,50 @@ msgid ""
214214"behavior. The sequence must be accessed in strictly sequential order; random"
215215" access and :meth:`~io.TextIOBase.readline` cannot be mixed."
216216msgstr ""
217+ "类 :class:`FileInput` 是一个实现;它的方法 :meth:`filename`, :meth:`fileno`, "
218+ ":meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`, :meth:`isstdin`, "
219+ ":meth:`nextfile` 和 :meth:`close` 对应于此模块中具有相同名称的函数。 此外它还有一个 "
220+ ":meth:`~io.TextIOBase.readline` 方法可返回下一个输入行,以及一个 :meth:`__getitem__` "
221+ "方法,该方法实现了序列行为。 这种序列必须以严格的序列顺序来读写;随机读写和 :meth:`~io.TextIOBase.readline` "
222+ "不可以被混用。"
217223
218224#: ../../library/fileinput.rst:151
219225msgid ""
220226"With *mode* you can specify which file mode will be passed to :func:`open`. "
221227"It must be one of ``'r'``, ``'rU'``, ``'U'`` and ``'rb'``."
222228msgstr ""
229+ "通过 *mode* 你可以指定要传给 :func:`open` 的文件模式。 它必须为 ``'r'``, ``'rU'``, ``'U'`` 和 "
230+ "``'rb'`` 中的一个。"
223231
224232#: ../../library/fileinput.rst:154
225233msgid ""
226234"The *openhook*, when given, must be a function that takes two arguments, "
227235"*filename* and *mode*, and returns an accordingly opened file-like object. "
228236"You cannot use *inplace* and *openhook* together."
229237msgstr ""
238+ "*openhook* 如果给出则必须为一个函数,它接受两个参数 *filename* 和 *mode*,并相应地返回一个打开的文件类对象。 "
239+ "你不能同时使用 *inplace* 和 *openhook*。"
230240
231241#: ../../library/fileinput.rst:158
232242msgid ""
233243"A :class:`FileInput` instance can be used as a context manager in the "
234244":keyword:`with` statement. In this example, *input* is closed after the "
235245":keyword:`!with` statement is exited, even if an exception occurs::"
236246msgstr ""
247+ ":class:`FileInput` 实例可以在 :keyword:`with` 语句中被用作上下文管理器。 在这个例子中,*input* 在 "
248+ ":keyword:`!with` 语句结束后将会被关闭,即使发生了异常也是如此::"
237249
238250#: ../../library/fileinput.rst:169
239251msgid "The ``'rU'`` and ``'U'`` modes."
240- msgstr ""
252+ msgstr "``'rU'`` 和 ``'U'`` 模式。 "
241253
242254#: ../../library/fileinput.rst:172
243255msgid "Support for :meth:`__getitem__` method is deprecated."
244- msgstr ""
256+ msgstr "对 :meth:`__getitem__` 方法的支持已弃用。 "
245257
246258#: ../../library/fileinput.rst:175
247259msgid "The keyword parameter *mode* and *openhook* are now keyword-only."
248- msgstr ""
260+ msgstr "关键字形参 *mode* 和 *openhook* 现在是仅限关键字形参。 "
249261
250262#: ../../library/fileinput.rst:180
251263msgid ""
@@ -260,10 +272,15 @@ msgid ""
260272"extension is ``'.bak'`` and it is deleted when the output file is closed. "
261273"In-place filtering is disabled when standard input is read."
262274msgstr ""
275+ "**可选的原地过滤:** 如果传递了关键字参数 ``inplace=True`` 给 :func:`fileinput.input` 或 "
276+ ":class:`FileInput` 构造器,则文件会被移至备份文件并将标准输出定向到输入文件(如果已存在与备份文件同名的文件,它将被静默地替换)。 "
277+ "这使得编写一个能够原地重写其输入文件的过滤器成为可能。 如果给出了 *backup* 形参 (通常形式为 ``backup='.<some "
278+ "extension>'``),它将指定备份文件的扩展名,并且备份文件会被保留;默认情况下扩展名为 ``'.bak'`` 并且它会在输出文件关闭时被删除。"
279+ " 在读取标准输入时原地过滤会被禁用。"
263280
264281#: ../../library/fileinput.rst:192
265282msgid "The two following opening hooks are provided by this module:"
266- msgstr ""
283+ msgstr "此模块提供了以下两种打开文件钩子: "
267284
268285#: ../../library/fileinput.rst:196
269286msgid ""
0 commit comments