Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc8bdcc

Browse files
Translate "Function" and "Exception" part oflibrary/re.po (#996)
Co-authored-by: Becca <61359625+beccalzh@users.noreply.github.com>
1 parent06b05d9 commitcc8bdcc

File tree

1 file changed

+87
-16
lines changed

1 file changed

+87
-16
lines changed

‎library/re.po

Lines changed: 87 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,14 +1221,16 @@ msgstr ""
12211221

12221222
#:../../library/re.rst:878
12231223
msgid"Functions"
1224-
msgstr""
1224+
msgstr"函式"
12251225

12261226
#:../../library/re.rst:882
12271227
msgid""
12281228
"Compile a regular expression pattern into a :ref:`regular expression object "
12291229
"<re-objects>`, which can be used for matching using its :func:`~Pattern."
12301230
"match`, :func:`~Pattern.search` and other methods, described below."
12311231
msgstr""
1232+
"將正規表示式模式編譯成\\ :ref:`正規表示式物件 <re-objects>`,可以使用它的 :"
1233+
"func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。"
12321234

12331235
#:../../library/re.rst:887../../library/re.rst:919../../library/re.rst:937
12341236
#:../../library/re.rst:948../../library/re.rst:994../../library/re.rst:1028
@@ -1239,31 +1241,37 @@ msgid ""
12391241
"Values can be any of the `flags`_ variables, combined using bitwise OR (the "
12401242
"``|`` operator)."
12411243
msgstr""
1244+
"可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位"
1245+
"元 OR(bitwise OR、``|`` 運算子)組合。"
12421246

12431247
#:../../library/re.rst:891
12441248
msgid"The sequence ::"
1245-
msgstr""
1249+
msgstr"順序為: ::"
12461250

12471251
#:../../library/re.rst:893
12481252
msgid""
12491253
"prog = re.compile(pattern)\n"
12501254
"result = prog.match(string)"
12511255
msgstr""
1256+
"prog = re.compile(pattern)\n"
1257+
"result = prog.match(string)"
12521258

12531259
#:../../library/re.rst:896
12541260
msgid"is equivalent to ::"
12551261
msgstr"等價於: ::"
12561262

12571263
#:../../library/re.rst:898
12581264
msgid"result = re.match(pattern, string)"
1259-
msgstr""
1265+
msgstr"result = re.match(pattern, string)"
12601266

12611267
#:../../library/re.rst:900
12621268
msgid""
12631269
"but using :func:`re.compile` and saving the resulting regular expression "
12641270
"object for reuse is more efficient when the expression will be used several "
12651271
"times in a single program."
12661272
msgstr""
1273+
"但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規"
1274+
"表示式物件以供重複使用會更有效率。"
12671275

12681276
#:../../library/re.rst:906
12691277
msgid""
@@ -1272,6 +1280,8 @@ msgid ""
12721280
"that use only a few regular expressions at a time needn't worry about "
12731281
"compiling regular expressions."
12741282
msgstr""
1283+
"傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取,"
1284+
"因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。"
12751285

12761286
#:../../library/re.rst:914
12771287
msgid""
@@ -1281,6 +1291,9 @@ msgid ""
12811291
"pattern; note that this is different from finding a zero-length match at "
12821292
"some point in the string."
12831293
msgstr""
1294+
"掃描 *string* 以尋找正規表示式 *pattern* 產生匹配的第一個位置,並回傳對應的 :"
1295+
"class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這"
1296+
"與在字串中的某個點查找零長度匹配不同。"
12841297

12851298
#:../../library/re.rst:926
12861299
msgid""
@@ -1289,25 +1302,34 @@ msgid ""
12891302
"``None`` if the string does not match the pattern; note that this is "
12901303
"different from a zero-length match."
12911304
msgstr""
1305+
"如果 *string* 開頭的零個或多個字元與正規表示式 *pattern* 匹配,則回傳對應的 :"
1306+
"class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度"
1307+
"匹配不同。"
12921308

12931309
#:../../library/re.rst:931
12941310
msgid""
12951311
"Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match "
12961312
"at the beginning of the string and not at the beginning of each line."
12971313
msgstr""
1314+
"請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串"
1315+
"的開頭匹配,而非每行的開頭。"
12981316

12991317
#:../../library/re.rst:934
13001318
msgid""
13011319
"If you want to locate a match anywhere in *string*, use :func:`search` "
13021320
"instead (see also :ref:`search-vs-match`)."
13031321
msgstr""
1322+
"如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參"
1323+
"閱 :ref:`search-vs-match`)。"
13041324

13051325
#:../../library/re.rst:944
13061326
msgid""
13071327
"If the whole *string* matches the regular expression *pattern*, return a "
13081328
"corresponding :class:`~re.Match`. Return ``None`` if the string does not "
13091329
"match the pattern; note that this is different from a zero-length match."
13101330
msgstr""
1331+
"如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re."
1332+
"Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。"
13111333

13121334
#:../../library/re.rst:957
13131335
msgid""
@@ -1317,6 +1339,9 @@ msgid ""
13171339
"*maxsplit* splits occur, and the remainder of the string is returned as the "
13181340
"final element of the list. ::"
13191341
msgstr""
1342+
"依 *pattern* 的出現次數拆分 *string*。如果在 *pattern* 中使用捕獲括號,則模式"
1343+
"中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發"
1344+
"生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::"
13201345

13211346
#:../../library/re.rst:963
13221347
msgid""
@@ -1344,6 +1369,8 @@ msgid ""
13441369
"of the string, the result will start with an empty string. The same holds "
13451370
"for the end of the string::"
13461371
msgstr""
1372+
"如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣"
1373+
"適用於字串的結尾: ::"
13471374

13481375
#:../../library/re.rst:976
13491376
msgid""
@@ -1357,13 +1384,13 @@ msgstr ""
13571384
msgid""
13581385
"That way, separator components are always found at the same relative indices "
13591386
"within the result list."
1360-
msgstr""
1387+
msgstr"如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。"
13611388

13621389
#:../../library/re.rst:982
13631390
msgid""
13641391
"Empty matches for the pattern split the string only when not adjacent to a "
13651392
"previous empty match."
1366-
msgstr""
1393+
msgstr"只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。"
13671394

13681395
#:../../library/re.rst:985
13691396
msgid""
@@ -1390,21 +1417,25 @@ msgstr "新增可選的旗標引數。"
13901417
#:../../library/re.rst:1001
13911418
msgid""
13921419
"Added support of splitting on a pattern that could match an empty string."
1393-
msgstr""
1420+
msgstr"新增了對可以匹配空字串之模式進行拆分的支援。"
13941421

13951422
#:../../library/re.rst:1004
13961423
msgid""
13971424
"Passing *maxsplit* and *flags* as positional arguments is deprecated. In "
13981425
"future Python versions they will be :ref:`keyword-only parameters <keyword-"
13991426
"only_parameter>`."
14001427
msgstr""
1428+
"將 *maxsplit* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本"
1429+
"中,它們將會是\\ :ref:`僅限關鍵字參數 <keyword-only_parameter>`。"
14011430

14021431
#:../../library/re.rst:1012
14031432
msgid""
14041433
"Return all non-overlapping matches of *pattern* in *string*, as a list of "
14051434
"strings or tuples. The *string* is scanned left-to-right, and matches are "
14061435
"returned in the order found. Empty matches are included in the result."
14071436
msgstr""
1437+
"以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右"
1438+
"掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。"
14081439

14091440
#:../../library/re.rst:1016
14101441
msgid""
@@ -1415,10 +1446,13 @@ msgid ""
14151446
"matching the groups. Non-capturing groups do not affect the form of the "
14161447
"result."
14171448
msgstr""
1449+
"結果取決於模式中捕獲群組的數量。如果沒有群組,則回傳與整個模式匹配的字串串"
1450+
"列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則"
1451+
"回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。"
14181452

14191453
#:../../library/re.rst:1032../../library/re.rst:1047
14201454
msgid"Non-empty matches can now start just after a previous empty match."
1421-
msgstr""
1455+
msgstr"非空匹配現在可以剛好在前一個空匹配的後面開始。"
14221456

14231457
#:../../library/re.rst:1038
14241458
msgid""
@@ -1427,6 +1461,9 @@ msgid ""
14271461
"scanned left-to-right, and matches are returned in the order found. Empty "
14281462
"matches are included in the result."
14291463
msgstr""
1464+
"回傳一個 :term:`iterator`,在 *string* 中的 RE *pattern* 的所有非重疊匹配上 "
1465+
"yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配"
1466+
"項目。結果中包含空匹配項。"
14301467

14311468
#:../../library/re.rst:1053
14321469
msgid""
@@ -1441,6 +1478,12 @@ msgid ""
14411478
"``\\6``, are replaced with the substring matched by group 6 in the pattern. "
14421479
"For example::"
14431480
msgstr""
1481+
"回傳透過以替換 *repl* 取代 *string* 中最左邊不重疊出現的 *pattern* 所獲得的字"
1482+
"串。如果未找到該模式,則不改變 *string* 並回傳。*repl* 可以是字串或函式;如果"
1483+
"它是字串,則處理其中的任何反斜線轉義。也就是說 ``\\n`` 會被轉換為單一換行符、"
1484+
"``\\r`` 會被轉換為回車符 (carriage return) 等等。ASCII 字母的未知轉義符會被保"
1485+
"留以供將來使用並被視為錯誤。其他未知轉義符例如 ``\\&`` 會被單獨保留。例如 "
1486+
"``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::"
14441487

14451488
#:../../library/re.rst:1064
14461489
msgid""
@@ -1460,6 +1503,8 @@ msgid ""
14601503
"of *pattern*. The function takes a single :class:`~re.Match` argument, and "
14611504
"returns the replacement string. For example::"
14621505
msgstr""
1506+
"如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接"
1507+
"收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::"
14631508

14641509
#:../../library/re.rst:1073
14651510
msgid""
@@ -1485,7 +1530,7 @@ msgstr ""
14851530

14861531
#:../../library/re.rst:1082
14871532
msgid"The pattern may be a string or a :class:`~re.Pattern`."
1488-
msgstr""
1533+
msgstr"此模式可以是字串或 :class:`~re.Pattern`。"
14891534

14901535
#:../../library/re.rst:1084
14911536
msgid""
@@ -1495,6 +1540,9 @@ msgid ""
14951540
"only when not adjacent to a previous empty match, so ``sub('x*', '-', "
14961541
"'abxd')`` returns ``'-a-b--d-'``."
14971542
msgstr""
1543+
"可選引數 *count* 是要替換的模式出現的最大次數;*count* 必須是非負整數。如果省"
1544+
"略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空"
1545+
"匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。"
14981546

14991547
#:../../library/re.rst:1092
15001548
msgid""
@@ -1508,50 +1556,67 @@ msgid ""
15081556
"backreference ``\\g<0>`` substitutes in the entire substring matched by the "
15091557
"RE."
15101558
msgstr""
1559+
"在字串型別 *repl* 引數中,除了上述字元轉義和反向參照之外,``\\g<name>`` 將使"
1560+
"用名為 ``name`` 的群組所匹配到的子字串,如 ``(?P<name>...)`` 所定義的語法。"
1561+
"``\\g<number>`` 使用對應的群組編號;因此 ``\\g<2>`` 等價於 ``\\2``,但在諸如 "
1562+
"``\\g<2>0`` 之類的替換中並非模糊不清 (isn't ambiguous)。``\\20`` 將被直譯為對"
1563+
"群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 "
1564+
"``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。"
15111565

15121566
#:../../library/re.rst:1109../../library/re.rst:1387
15131567
msgid"Unmatched groups are replaced with an empty string."
1514-
msgstr""
1568+
msgstr"不匹配的群組將被替換為空字串。"
15151569

15161570
#:../../library/re.rst:1112
15171571
msgid""
15181572
"Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now "
15191573
"are errors."
15201574
msgstr""
1575+
"在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。"
15211576

15221577
#:../../library/re.rst:1116
15231578
msgid""
15241579
"Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are "
15251580
"errors. Empty matches for the pattern are replaced when adjacent to a "
15261581
"previous non-empty match."
15271582
msgstr""
1583+
"由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前"
1584+
"的非空匹配相鄰時,模式的空匹配將被替換。"
15281585

15291586
#:../../library/re.rst:1122
15301587
msgid""
15311588
"Group *id* can only contain ASCII digits. In :class:`bytes` replacement "
15321589
"strings, group *name* can only contain bytes in the ASCII range "
15331590
"(``b'\\x00'``-``b'\\x7f'``)."
15341591
msgstr""
1592+
"群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能"
1593+
"包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。"
15351594

15361595
#:../../library/re.rst:1127
15371596
msgid""
15381597
"Passing *count* and *flags* as positional arguments is deprecated. In future "
15391598
"Python versions they will be :ref:`keyword-only parameters <keyword-"
15401599
"only_parameter>`."
15411600
msgstr""
1601+
"將 *count* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本"
1602+
"中,它們將會是\\ :ref:`僅限關鍵字參數 <keyword-only_parameter>`。"
15421603

15431604
#:../../library/re.rst:1135
15441605
msgid""
15451606
"Perform the same operation as :func:`sub`, but return a tuple ``(new_string, "
15461607
"number_of_subs_made)``."
15471608
msgstr""
1609+
"執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, "
1610+
"number_of_subs_made)``。"
15481611

15491612
#:../../library/re.rst:1145
15501613
msgid""
15511614
"Escape special characters in *pattern*. This is useful if you want to match "
15521615
"an arbitrary literal string that may have regular expression metacharacters "
15531616
"in it. For example::"
15541617
msgstr""
1618+
"對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字"
1619+
"元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::"
15551620

15561621
#:../../library/re.rst:1149
15571622
msgid""
@@ -1584,6 +1649,8 @@ msgid ""
15841649
"This function must not be used for the replacement string in :func:`sub` "
15851650
"and :func:`subn`, only backslashes should be escaped. For example::"
15861651
msgstr""
1652+
"此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例"
1653+
"如: ::"
15871654

15881655
#:../../library/re.rst:1163
15891656
msgid""
@@ -1599,7 +1666,7 @@ msgstr ""
15991666

16001667
#:../../library/re.rst:1168
16011668
msgid"The ``'_'`` character is no longer escaped."
1602-
msgstr""
1669+
msgstr"``'_'`` 字元不再被轉義。"
16031670

16041671
#:../../library/re.rst:1171
16051672
msgid""
@@ -1611,7 +1678,7 @@ msgstr ""
16111678

16121679
#:../../library/re.rst:1180
16131680
msgid"Clear the regular expression cache."
1614-
msgstr""
1681+
msgstr"清除正規表示式快取。"
16151682

16161683
#:../../library/re.rst:1184
16171684
msgid"Exceptions"
@@ -1626,26 +1693,29 @@ msgid ""
16261693
"pattern. The ``PatternError`` instance has the following additional "
16271694
"attributes:"
16281695
msgstr""
1696+
"當傳遞給此處函式之一的字串不是有效的正規表示式(例如它可能包含不匹配的括號)"
1697+
"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項,則"
1698+
"絕不是錯誤。``PatternError`` 實例具有以下附加屬性:"
16291699

16301700
#:../../library/re.rst:1196
16311701
msgid"The unformatted error message."
1632-
msgstr""
1702+
msgstr"未格式化的錯誤訊息。"
16331703

16341704
#:../../library/re.rst:1200
16351705
msgid"The regular expression pattern."
1636-
msgstr""
1706+
msgstr"正規表示式模式。"
16371707

16381708
#:../../library/re.rst:1204
16391709
msgid"The index in *pattern* where compilation failed (may be ``None``)."
1640-
msgstr""
1710+
msgstr"*pattern* 中編譯失敗的索引(可能是 ``None``)。"
16411711

16421712
#:../../library/re.rst:1208
16431713
msgid"The line corresponding to *pos* (may be ``None``)."
1644-
msgstr""
1714+
msgstr"對應 *pos* 的列(可能是 ``None``)。"
16451715

16461716
#:../../library/re.rst:1212
16471717
msgid"The column corresponding to *pos* (may be ``None``)."
1648-
msgstr""
1718+
msgstr"對應 *pos* 的欄(可能是 ``None``)。"
16491719

16501720
#:../../library/re.rst:1214
16511721
msgid"Added additional attributes."
@@ -1656,6 +1726,7 @@ msgid ""
16561726
"``PatternError`` was originally named ``error``; the latter is kept as an "
16571727
"alias for backward compatibility."
16581728
msgstr""
1729+
"``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。"
16591730

16601731
#:../../library/re.rst:1224
16611732
msgid"Regular Expression Objects"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp