@@ -130,6 +130,8 @@ msgid ""
130
130
" like ``$x`` and replacing them with values from a dictionary, but offers "
131
131
"much less control of the formatting."
132
132
msgstr ""
133
+ ":mod:`string` モジュールの :class:`~string.Template` クラスも、文字列中の値を置換する別の方法を提供しています。"
134
+ " ``$x`` のようなプレースホルダーを使い、その箇所と辞書にある値を置き換えますが、使えるフォーマット方式はとても少ないです。"
133
135
134
136
#: ../../tutorial/inputoutput.rst:100
135
137
msgid "Formatted String Literals"
@@ -142,36 +144,45 @@ msgid ""
142
144
"prefixing the string with ``f`` or ``F`` and writing expressions as "
143
145
"``{expression}``."
144
146
msgstr ""
147
+ ":ref:`フォーマット済み文字リテラル <f-strings>` (短くして f-string とも呼びます) では、文字列の頭に ``f`` か "
148
+ "``F`` を付け、式を ``{expression}`` と書くことで、 Python の式の値を文字列の中に入れ込めます。"
145
149
146
150
#: ../../tutorial/inputoutput.rst:107
147
151
msgid ""
148
152
"An optional format specifier can follow the expression. This allows greater "
149
153
"control over how the value is formatted. The following example rounds pi to "
150
154
"three places after the decimal::"
151
155
msgstr ""
156
+ "オプションのフォーマット指定子を式の後ろに付けられます。\n"
157
+ "このフォーマット指定子によって値のフォーマット方式を制御できます。\n"
158
+ "次の例では、円周率πを小数点以下3桁に丸めてフォーマットしています::"
152
159
153
160
#: ../../tutorial/inputoutput.rst:115
154
161
msgid ""
155
162
"Passing an integer after the ``':'`` will cause that field to be a minimum "
156
163
"number of characters wide. This is useful for making columns line up. ::"
157
164
msgstr ""
165
+ "``':'`` の後ろに整数をつけると、そのフィールドの最小の文字幅を指定できます。\n"
166
+ "この機能は縦を揃えるのに便利です。 ::"
158
167
159
168
#: ../../tutorial/inputoutput.rst:126
160
169
msgid ""
161
170
"Other modifiers can be used to convert the value before it is formatted. "
162
171
"``'!a'`` applies :func:`ascii`, ``'!s'`` applies :func:`str`, and ``'!r'`` "
163
172
"applies :func:`repr`::"
164
173
msgstr ""
174
+ "他の修飾子は、フォーマットする前に値を変換するのに使えます。\n"
175
+ "``'!a'`` は :func:`ascii` を、 ``'!s'`` は :func:`str` を、 ``'!r'`` は :func:`repr` を適用します::"
165
176
166
177
#: ../../tutorial/inputoutput.rst:136
167
178
msgid ""
168
179
"For a reference on these format specifications, see the reference guide for "
169
180
"the :ref:`formatspec`."
170
- msgstr ""
181
+ msgstr "これらのフォーマット仕様の参考資料として、 :ref:`formatspec` のガイドを参照してください。 "
171
182
172
183
#: ../../tutorial/inputoutput.rst:142
173
184
msgid "The String format() Method"
174
- msgstr ""
185
+ msgstr "文字列の format() メソッド "
175
186
176
187
#: ../../tutorial/inputoutput.rst:144
177
188
msgid "Basic usage of the :meth:`str.format` method looks like this::"
@@ -224,7 +235,7 @@ msgstr "全てのローカルな変数が入った辞書を返す組み込み関
224
235
msgid ""
225
236
"As an example, the following lines produce a tidily-aligned set of columns "
226
237
"giving integers and their squares and cubes::"
227
- msgstr ""
238
+ msgstr "例として、下のコード行は与えられた整数とその 2 乗と 3 乗がきちんと揃った列を生成します:: "
228
239
229
240
#: ../../tutorial/inputoutput.rst:209
230
241
msgid ""
@@ -234,17 +245,19 @@ msgstr ":meth:`str.format` による文字列書式設定の完全な解説は
234
245
235
246
#: ../../tutorial/inputoutput.rst:214
236
247
msgid "Manual String Formatting"
237
- msgstr ""
248
+ msgstr "文字列の手作業でのフォーマット "
238
249
239
250
#: ../../tutorial/inputoutput.rst:216
240
251
msgid "Here's the same table of squares and cubes, formatted manually::"
241
- msgstr ""
252
+ msgstr "次は 2 乗と 3 乗の値からなる同じ表を手作業でフォーマットしたものです:: "
242
253
243
254
#: ../../tutorial/inputoutput.rst:234
244
255
msgid ""
245
256
"(Note that the one space between each column was added by the way "
246
257
":func:`print` works: it always adds spaces between its arguments.)"
247
258
msgstr ""
259
+ "(各カラムの間のスペース一個分は :func:`print` の動作で追加されていることに注意してください。 :func:`print` "
260
+ "は常に引数間に空白を追加します。)"
248
261
249
262
#: ../../tutorial/inputoutput.rst:237
250
263
msgid ""
@@ -257,6 +270,11 @@ msgid ""
257
270
"would be lying about a value. (If you really want truncation you can always "
258
271
"add a slice operation, as in ``x.ljust(n)[:n]``.)"
259
272
msgstr ""
273
+ "文字列オブジェクトの :meth:`str.rjust` メソッドは、指定された幅のフィールド内に文字列が右寄せで入るように左側に空白を追加します。\n"
274
+ "同様のメソッドとして、 :meth:`str.ljust` と :meth:`str.center` があります。\n"
275
+ "これらのメソッドは何か出力を行うわけではなく、ただ新しい文字列を返します。\n"
276
+ "入力文字列が長すぎる場合、文字列を切り詰めることはせず、値をそのまま返します。この仕様のためにカラムのレイアウトが滅茶苦茶になるかもしれませんが、嘘の値が代わりに書き出されるよりはましです。\n"
277
+ "(本当に切り詰めを行いたいのなら、全てのカラムに ``x.ljust(n)[:n]`` のようにスライス表記を加えることもできます。)"
260
278
261
279
#: ../../tutorial/inputoutput.rst:246
262
280
msgid ""
0 commit comments