@@ -98,10 +98,13 @@ msgid ""
9898"and returns an accordingly opened file-like object. Two useful hooks are "
9999"already provided by this module."
100100msgstr ""
101+ "想要控制文件的打开方式,你可以通过将 *openhook* 形参传给 :func:`fileinput.input` 或 "
102+ ":class:`FileInput()` 来提供一个打开钩子。 此钩子必须为一个函数,它接受两个参数,*filename* 和 "
103+ "*mode*,并返回一个以相应模式打开的文件类对象。 此模块已经提供了两个有用的钩子。"
101104
102105#: ../../library/fileinput.rst:55
103106msgid "The following function is the primary interface of this module:"
104- msgstr ""
107+ msgstr "以下函数是此模块的初始接口: "
105108
106109#: ../../library/fileinput.rst:60
107110msgid ""
@@ -110,66 +113,71 @@ msgid ""
110113"to use during iteration. The parameters to this function will be passed "
111114"along to the constructor of the :class:`FileInput` class."
112115msgstr ""
116+ "创建一个 :class:`FileInput` 类的实例。 该实例将被用作此模块中函数的全局状态,并且还将在迭代期间被返回使用。 "
117+ "此函数的形参将被继续传递给 :class:`FileInput` 类的构造器。"
113118
114119#: ../../library/fileinput.rst:65
115120msgid ""
116121"The :class:`FileInput` instance can be used as a context manager in the "
117122":keyword:`with` statement. In this example, *input* is closed after the "
118123":keyword:`!with` statement is exited, even if an exception occurs::"
119124msgstr ""
125+ ":class:`FileInput` 实例可以在 :keyword:`with` 语句中被用作上下文管理器。 在这个例子中,*input* 在 "
126+ ":keyword:`!with` 语句结束后将会被关闭,即使发生了异常也是如此::"
120127
121128#: ../../library/fileinput.rst:73 ../../library/fileinput.rst:166
122129msgid "Can be used as a context manager."
123- msgstr ""
130+ msgstr "可以被用作上下文管理器。 "
124131
125132#: ../../library/fileinput.rst:76
126133msgid "The keyword parameters *mode* and *openhook* are now keyword-only."
127- msgstr ""
134+ msgstr "关键字形参 *mode* 和 *openhook* 现在是仅限关键字形参。 "
128135
129136#: ../../library/fileinput.rst:80
130137msgid ""
131138"The following functions use the global state created by "
132139":func:`fileinput.input`; if there is no active state, :exc:`RuntimeError` is"
133140" raised."
134141msgstr ""
142+ "下列函数会使用 :func:`fileinput.input` 所创建的全局状态;如果没有活动的状态,则会引发 :exc:`RuntimeError`。"
135143
136144#: ../../library/fileinput.rst:86
137145msgid ""
138146"Return the name of the file currently being read. Before the first line has"
139147" been read, returns ``None``."
140- msgstr ""
148+ msgstr "返回当前被读取的文件名。 在第一行被读取之前,返回 ``None``。 "
141149
142150#: ../../library/fileinput.rst:92
143151msgid ""
144152"Return the integer \" file descriptor\" for the current file. When no file is"
145153" opened (before the first line and between files), returns ``-1``."
146- msgstr ""
154+ msgstr "返回以整数表示的当前文件“文件描述符”。 当未打开文件时(处在第一行和文件之间),返回 ``-1``。 "
147155
148156#: ../../library/fileinput.rst:98
149157msgid ""
150158"Return the cumulative line number of the line that has just been read. "
151159"Before the first line has been read, returns ``0``. After the last line of "
152160"the last file has been read, returns the line number of that line."
153- msgstr ""
161+ msgstr "返回已被读取的累计行号。 在第一行被读取之前,返回 ``0``。 在最后一个文件的最后一行被读取之后,返回该行的行号。 "
154162
155163#: ../../library/fileinput.rst:105
156164msgid ""
157165"Return the line number in the current file. Before the first line has been "
158166"read, returns ``0``. After the last line of the last file has been read, "
159167"returns the line number of that line within the file."
160- msgstr ""
168+ msgstr "返回当前文件中的行号。 在第一行被读取之前,返回 ``0``。 在最后一个文件的最后一行被读取之后,返回此文件中该行的行号。 "
161169
162170#: ../../library/fileinput.rst:112
163171msgid ""
164172"Return ``True`` if the line just read is the first line of its file, "
165173"otherwise return ``False``."
166- msgstr ""
174+ msgstr "如果刚读取的行是其所在文件的第一行则返回 ``True``,否则返回 ``False``。 "
167175
168176#: ../../library/fileinput.rst:118
169177msgid ""
170178"Return ``True`` if the last line was read from ``sys.stdin``, otherwise "
171179"return ``False``."
172- msgstr ""
180+ msgstr "如果最后读取的行来自 ``sys.stdin`` 则返回 ``True``,否则返回 ``False``。 "
173181
174182#: ../../library/fileinput.rst:124
175183msgid ""
@@ -181,10 +189,13 @@ msgid ""
181189"file. After the last line of the last file has been read, this function has"
182190" no effect."
183191msgstr ""
192+ "关闭当前文件以使下次迭代将从下一个文件(如果存在)读取第一行;不是从该文件读取的行将不会被计入累计行数。 "
193+ "直到下一个文件的第一行被读取之后文件名才会改变。 在第一行被读取之前,此函数将不会生效;它不能被用来跳过第一个文件。 "
194+ "在最后一个文件的最后一行被读取之后,此函数将不再生效。"
184195
185196#: ../../library/fileinput.rst:134
186197msgid "Close the sequence."
187- msgstr ""
198+ msgstr "关闭序列。 "
188199
189200#: ../../library/fileinput.rst:136
190201msgid ""
0 commit comments