@@ -72,24 +72,23 @@ msgid ""
7272"substituted and can provide detailed formatting directives, but you'll also "
7373"need to provide the information to be formatted."
7474msgstr ""
75- "字符串的 :meth:`str.format` 方法需要更多的手动操作 。该方法仍使用 ``{`` 和 ``}`` "
76- "标记要替换的变量的位置 ,该方法还支持详细的格式化指令,但需要提供格式化信息。"
75+ "字符串的 :meth:`str.format` 方法需要更多手动操作 。该方法仍使用 ``{`` 和 ``}`` "
76+ "标记替换变量的位置 ,该方法还支持详细的格式化指令,但需要提供格式化信息。"
7777
7878#: ../../tutorial/inputoutput.rst:50
7979msgid ""
8080"Finally, you can do all the string handling yourself by using string slicing"
8181" and concatenation operations to create any layout you can imagine. The "
8282"string type has some methods that perform useful operations for padding "
8383"strings to a given column width."
84- msgstr ""
85- "最后,还可以用字符串切片和合并完成各种字符串处理操作,创建任何想要的排版布局。字符串类型还支持将字符串按给定列宽进行填充,这些方法也很有用。"
84+ msgstr "最后,还可以用字符串切片和合并操作完成字符串处理操作,创建任何排版布局。字符串类型还支持将字符串按给定列宽进行填充,这些方法也很有用。"
8685
8786#: ../../tutorial/inputoutput.rst:55
8887msgid ""
8988"When you don't need fancy output but just want a quick display of some "
9089"variables for debugging purposes, you can convert any value to a string with"
9190" the :func:`repr` or :func:`str` functions."
92- msgstr "如果不需要花哨的输出,只想快速显示变量以进行调试 ,可以用 :func:`repr` 或 :func:`str` 函数把值转化为字符串。"
91+ msgstr "如果不需要花哨的输出,只想快速显示变量进行调试 ,可以用 :func:`repr` 或 :func:`str` 函数把值转化为字符串。"
9392
9493#: ../../tutorial/inputoutput.rst:59
9594msgid ""
@@ -102,9 +101,9 @@ msgid ""
102101" structures like lists and dictionaries, have the same representation using "
103102"either function. Strings, in particular, have two distinct representations."
104103msgstr ""
105- ":func:`str` 函数返回适于人类阅读的值 ,:func:`repr` 则生成适于解释器读取的值(如果没有等效的语法,则强制执行 "
106- ":exc:`SyntaxError`)。对于没有适合人类阅读展示结果的对象 , :func:`str` 返回与 :func:`repr` "
107- "一样的值 。一般情况下,数字、列表或字典等结构的值,使用这两个函数输出的展现形式是一样的。字符串则不同,有两种不同的展现形式 。"
104+ ":func:`str` 函数返回供人阅读的值 ,:func:`repr` 则生成适于解释器读取的值(如果没有等效的语法,则强制执行 "
105+ ":exc:`SyntaxError`)。对于没有支持供人阅读展示结果的对象 , :func:`str` 返回与 :func:`repr` "
106+ "相同的值 。一般情况下,数字、列表或字典等结构的值,使用这两个函数输出的表现形式是一样的。字符串有两种不同的表现形式 。"
108107
109108#: ../../tutorial/inputoutput.rst:68
110109msgid "Some examples::"
@@ -117,8 +116,8 @@ msgid ""
117116" like ``$x`` and replacing them with values from a dictionary, but offers "
118117"much less control of the formatting."
119118msgstr ""
120- ":mod:`string` 模块包含一个叫 :class:`~string.Template` 的类,提供了另一种将值替换为字符串的方法 。该类使用 "
121- "``$x`` 占位符,并用字典的值进行替换,但这种方式对格式控制的支持比较有限 。"
119+ ":mod:`string` 模块包含 :class:`~string.Template` 类,提供了将值替换为字符串的另一种方法 。该类使用 ``$x`` "
120+ " 占位符,并用字典的值进行替换,但对格式控制的支持比较有限 。"
122121
123122#: ../../tutorial/inputoutput.rst:100
124123msgid "Formatted String Literals"
@@ -131,36 +130,36 @@ msgid ""
131130"prefixing the string with ``f`` or ``F`` and writing expressions as "
132131"``{expression}``."
133132msgstr ""
134- ":ref:`格式化字符串字面值 <f-strings>` (简称为 f-字符串)在字符串前添加前缀 ``f`` 或 ``F``,通赤 "
135- "``{expression}`` 的形式输入表达式,从而把 Python 表达式的值包含在字符串内 。"
133+ ":ref:`格式化字符串字面值 <f-strings>` (简称为 f-字符串)在字符串前加前缀 ``f`` 或 ``F``,通过 "
134+ "``{expression}`` 表达式,把 Python 表达式的值添加到字符串内 。"
136135
137136#: ../../tutorial/inputoutput.rst:107
138137msgid ""
139138"An optional format specifier can follow the expression. This allows greater "
140139"control over how the value is formatted. The following example rounds pi to "
141140"three places after the decimal::"
142- msgstr "格式说明符在表达式后面,是可选的,该说明符可以更好地控制值的格式化方式 。下例将 pi 舍入到小数点后三位:"
141+ msgstr "格式说明符是可选的,写在表达式后面,可以更好地控制格式化值的方式 。下例将 pi 舍入到小数点后三位:"
143142
144143#: ../../tutorial/inputoutput.rst:115
145144msgid ""
146145"Passing an integer after the ``':'`` will cause that field to be a minimum "
147146"number of characters wide. This is useful for making columns line up. ::"
148- msgstr "在 ``':'`` 后传递整数,为该字段设置最小字符宽度。这种操作常用于列对齐 :"
147+ msgstr "在 ``':'`` 后传递整数,为该字段设置最小字符宽度,常用于列对齐 :"
149148
150149#: ../../tutorial/inputoutput.rst:126
151150msgid ""
152151"Other modifiers can be used to convert the value before it is formatted. "
153152"``'!a'`` applies :func:`ascii`, ``'!s'`` applies :func:`str`, and ``'!r'`` "
154153"applies :func:`repr`::"
155154msgstr ""
156- "下述修饰符用于在格式化前转换值 。 ``'!a'`` 应用 :func:`ascii` ,``'!s'`` 应用 :func:`str`,``'!r'`` "
157- " 应用 :func:`repr`:"
155+ "还有一些修饰符可以在格式化前转换值 。 ``'!a'`` 应用 :func:`ascii` ,``'!s'`` 应用 "
156+ ":func:`str`,``'!r'`` 应用 :func:`repr`:"
158157
159158#: ../../tutorial/inputoutput.rst:136
160159msgid ""
161160"For a reference on these format specifications, see the reference guide for "
162161"the :ref:`formatspec`."
163- msgstr "有关格式规范的参考,详见参考指南 :ref:`formatspec`。"
162+ msgstr "格式规范参考详见参考指南 :ref:`formatspec`。"
164163
165164#: ../../tutorial/inputoutput.rst:142
166165msgid "The String format() Method"
@@ -177,14 +176,14 @@ msgid ""
177176" brackets can be used to refer to the position of the object passed into the"
178177" :meth:`str.format` method. ::"
179178msgstr ""
180- "花括号及其内部的字符 (称为格式字段)被替换为传递给 :meth:`str.format` 方法的对象。花括号中的数字表示传递给 "
181- ":meth:`str.format` 方法的对象的位置 。"
179+ "花括号及之内的字符 (称为格式字段)被替换为传递给 :meth:`str.format` 方法的对象。花括号中的数字表示传递给 "
180+ ":meth:`str.format` 方法的对象所在的位置 。"
182181
183182#: ../../tutorial/inputoutput.rst:159
184183msgid ""
185184"If keyword arguments are used in the :meth:`str.format` method, their values"
186185" are referred to by using the name of the argument. ::"
187- msgstr "在 :meth:`str.format` 方法中使用关键字参数时,使用该参数名引用值 。"
186+ msgstr ":meth:`str.format` 方法中使用关键字参数名引用值 。"
188187
189188#: ../../tutorial/inputoutput.rst:166
190189msgid "Positional and keyword arguments can be arbitrarily combined::"
@@ -196,7 +195,8 @@ msgid ""
196195"would be nice if you could reference the variables to be formatted by name "
197196"instead of by position. This can be done by simply passing the dict and "
198197"using square brackets ``'[]'`` to access the keys. ::"
199- msgstr "如果不想分拆长格式字符串,最好按名称,不要按位置引用变量进行格式化。这项操作可以通过传递字典,并用方括号 ``'[]'`` 访问键来完成。"
198+ msgstr ""
199+ "如果不想分拆较长的格式字符串,最好按名称引用变量进行格式化,不要按位置。这项操作可以通过传递字典,并用方括号 ``'[]'`` 访问键来完成。"
200200
201201#: ../../tutorial/inputoutput.rst:182
202202msgid ""
@@ -208,33 +208,33 @@ msgstr "也可以用 '**' 符号,把 table 当作传递的关键字参数。"
208208msgid ""
209209"This is particularly useful in combination with the built-in function "
210210":func:`vars`, which returns a dictionary containing all local variables."
211- msgstr "这在与内置函数 :func:`vars` 结合使用时非常有用,它会返回包含所有局部变量的字典 。"
211+ msgstr "与内置函数 :func:`vars` 结合使用时,这种方式非常实用,可以返回包含所有局部变量的字典 。"
212212
213213#: ../../tutorial/inputoutput.rst:192
214214msgid ""
215215"As an example, the following lines produce a tidily-aligned set of columns "
216216"giving integers and their squares and cubes::"
217- msgstr "例如,下面几行代码生成一组整齐的列,其中包含给定的整数和它的平方以及立方:: "
217+ msgstr "例如,下面的代码生成一组整齐的列,包含给定整数及其平方与立方: "
218218
219219#: ../../tutorial/inputoutput.rst:209
220220msgid ""
221221"For a complete overview of string formatting with :meth:`str.format`, see "
222222":ref:`formatstrings`."
223- msgstr "关于使用 :meth:`str.format` 进行字符串格式化的完整概述,请参阅 :ref:`formatstrings` 。"
223+ msgstr ":meth:`str.format` 进行字符串格式化的完整概述详见 :ref:`formatstrings` 。"
224224
225225#: ../../tutorial/inputoutput.rst:214
226226msgid "Manual String Formatting"
227227msgstr "手动格式化字符串"
228228
229229#: ../../tutorial/inputoutput.rst:216
230230msgid "Here's the same table of squares and cubes, formatted manually::"
231- msgstr "这是同一个平方和立方的表,手动格式化的:: "
231+ msgstr "下面是使用手动格式化方式实现的同一个平方和立方的表: "
232232
233233#: ../../tutorial/inputoutput.rst:234
234234msgid ""
235235"(Note that the one space between each column was added by the way "
236236":func:`print` works: it always adds spaces between its arguments.)"
237- msgstr "(注意每列之间的一个空格是通过使用 :func:`print` 的方式添加的:它总是在其参数间添加空格 。)"
237+ msgstr "(注意,每列之间的空格是通过使用 :func:`print` 添加的:它总在其参数间添加空格 。)"
238238
239239#: ../../tutorial/inputoutput.rst:237
240240msgid ""
0 commit comments