@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.13\n "
13
13
"Report-Msgid-Bugs-To : \n "
14
- "POT-Creation-Date : 2025-02-21 14:16 +0000\n "
14
+ "POT-Creation-Date : 2025-05-23 14:55 +0000\n "
15
15
"PO-Revision-Date : 2025-05-08 05:09+0000\n "
16
16
"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
17
17
"Language-Team : Portuguese (Brazil) (https://app.transifex.com/python-doc/ "
@@ -2681,18 +2681,18 @@ msgid ""
2681
2681
"pattern isn't found, *string* is returned unchanged."
2682
2682
msgstr ""
2683
2683
"Retorna a string obtida substituindo as ocorrências mais à esquerda não "
2684
- "sobrepostas da RE em ``string`` pela substituição ``replacement``. Se o "
2685
- "padrão não for encontrado, a ``string`` é retornada inalterada."
2684
+ "sobrepostas da RE em ``string`` pelo valor de substituição ``replacement``. "
2685
+ "Se o padrão não for encontrado, a ``string`` é retornada inalterada."
2686
2686
2687
2687
#: ../../howto/regex.rst:1147
2688
2688
msgid ""
2689
2689
"The optional argument *count* is the maximum number of pattern occurrences "
2690
2690
"to be replaced; *count* must be a non-negative integer. The default value "
2691
2691
"of 0 means to replace all occurrences."
2692
2692
msgstr ""
2693
- "O argumento opcional `` count`` é o número máximo de ocorrências do padrão a "
2694
- "ser substituído; `` count`` deve ser um número inteiro não negativo. O valor "
2695
- "padrão ``0`` significa para substituir todas as ocorrências."
2693
+ "O argumento opcional * count* é o número máximo de ocorrências do padrão a "
2694
+ "ser substituído; * count* deve ser um número inteiro não negativo. O valor "
2695
+ "padrão 0 significa substituir todas as ocorrências."
2696
2696
2697
2697
#: ../../howto/regex.rst:1151
2698
2698
msgid ""
@@ -2710,6 +2710,11 @@ msgid ""
2710
2710
">>> p.sub('colour', 'blue socks and red shoes', count=1)\n"
2711
2711
"'colour socks and red shoes'"
2712
2712
msgstr ""
2713
+ ">>> p = re.compile('(blue|white|red)')\n"
2714
+ ">>> p.sub('colour', 'blue socks and red shoes')\n"
2715
+ "'colour socks and colour shoes'\n"
2716
+ ">>> p.sub('colour', 'blue socks and red shoes', count=1)\n"
2717
+ "'colour socks and red shoes'"
2713
2718
2714
2719
#: ../../howto/regex.rst:1160
2715
2720
msgid ""
@@ -2718,7 +2723,7 @@ msgid ""
2718
2723
"were performed::"
2719
2724
msgstr ""
2720
2725
"O método :meth:`~re.Pattern.subn` faz o mesmo trabalho, mas retorna uma "
2721
- "tupla com duas informações; contém uma string com novo valor e o número de "
2726
+ "tupla com duas informações: uma string com novo valor e o número de "
2722
2727
"substituições que foram realizadas:"
2723
2728
2724
2729
#: ../../howto/regex.rst:1163
@@ -2729,6 +2734,11 @@ msgid ""
2729
2734
">>> p.subn('colour', 'no colours at all')\n"
2730
2735
"('no colours at all', 0)"
2731
2736
msgstr ""
2737
+ ">>> p = re.compile('(blue|white|red)')\n"
2738
+ ">>> p.subn('colour', 'blue socks and red shoes')\n"
2739
+ "('colour socks and colour shoes', 2)\n"
2740
+ ">>> p.subn('colour', 'no colours at all')\n"
2741
+ "('no colours at all', 0)"
2732
2742
2733
2743
#: ../../howto/regex.rst:1169
2734
2744
msgid ""
@@ -2744,6 +2754,9 @@ msgid ""
2744
2754
">>> p.sub('-', 'abxd')\n"
2745
2755
"'-a-b--d-'"
2746
2756
msgstr ""
2757
+ ">>> p = re.compile('x*')\n"
2758
+ ">>> p.sub('-', 'abxd')\n"
2759
+ "'-a-b--d-'"
2747
2760
2748
2761
#: ../../howto/regex.rst:1176
2749
2762
msgid ""
@@ -2755,28 +2768,31 @@ msgid ""
2755
2768
"incorporate portions of the original text in the resulting replacement "
2756
2769
"string."
2757
2770
msgstr ""
2758
- "Se a substituição (replacement) é uma string, qualquer barra invertida é "
2759
- "interpretada e processada. Isto é, ``\\ n`` é convertido a um único caractere "
2760
- "de nova linha, ``\\ r`` é convertido em um retorno do carro, e assim por "
2761
- "diante. Casos desconhecidos, como ``\\ &`` são ignorados. Referências "
2762
- "anteriores (retrovisor - Aurelio) , como ``\\ 6``, são substituídas com a "
2763
- "substring correspondida pelo grupo correspondente na RE. Isso permite que "
2764
- "você incorpore partes do texto original na string de substituição resultante."
2771
+ "Se o valor de substituição (* replacement* ) é uma string, qualquer barra "
2772
+ "invertida é interpretada e processada. Isto é, ``\\ n`` é convertido a um "
2773
+ "único caractere de nova linha, ``\\ r`` é convertido em um retorno do carro, "
2774
+ "e assim por diante. Casos desconhecidos, como ``\\ &`` são ignorados. "
2775
+ "Referências anteriores , como ``\\ 6``, são substituídas com a substring "
2776
+ "correspondida pelo grupo correspondente na RE. Isso permite que você "
2777
+ "incorpore partes do texto original na string de substituição resultante."
2765
2778
2766
2779
#: ../../howto/regex.rst:1183
2767
2780
msgid ""
2768
2781
"This example matches the word ``section`` followed by a string enclosed in "
2769
2782
"``{``, ``}``, and changes ``section`` to ``subsection``::"
2770
2783
msgstr ""
2771
2784
"Este exemplo corresponde com a palavra ``section``, seguida por uma string "
2772
- "colocada entre ``{, }`` e altera ``section`` para ``subsection``::"
2785
+ "colocada entre ``{``, `` }``, e altera ``section`` para ``subsection``::"
2773
2786
2774
2787
#: ../../howto/regex.rst:1186
2775
2788
msgid ""
2776
2789
">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n"
2777
2790
">>> p.sub(r'subsection{\\ 1}','section{First} section{second}')\n"
2778
2791
"'subsection{First} subsection{second}'"
2779
2792
msgstr ""
2793
+ ">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n"
2794
+ ">>> p.sub(r'subsection{\\ 1}','section{First} section{second}')\n"
2795
+ "'subsection{First} subsection{second}'"
2780
2796
2781
2797
#: ../../howto/regex.rst:1190
2782
2798
msgid ""
@@ -2792,12 +2808,12 @@ msgstr ""
2792
2808
"Há também uma sintaxe para se referir a grupos nomeados como definido pela "
2793
2809
"sintaxe ``(?P<name>...)``. ``\\ g<name>`` usará a substring correspondida "
2794
2810
"pelo grupo com nome ``name`` e ``\\ g<number>`` utiliza o número do grupo "
2795
- "correspondente. ``. \\ g<2>`` é, portanto, equivalente a ``\\ 2``, mas não é "
2796
- "ambígua em uma string de substituição (replacement) , tal como ``\\ g<2>0``. "
2797
- "(`` \\ 20`` seria interpretado como uma referência ao grupo de ``20`` , e não "
2798
- "uma referência ao grupo ``2`` seguido pelo caractere literal ``0 ``). As "
2799
- "substituições a seguir são todas equivalentes, mas usam todas as três "
2800
- "variações da string de substituição. ::"
2811
+ "correspondente. ``\\ g<2>`` é, portanto, equivalente a ``\\ 2``, mas não é "
2812
+ "ambígua em uma string de substituição, tal como ``\\ g<2>0``. (`` \\ 20`` seria "
2813
+ "interpretado como uma referência ao grupo de 20 , e não uma referência ao "
2814
+ "grupo 2 seguido pelo caractere literal ``'0' ``). As substituições a seguir "
2815
+ "são todas equivalentes, mas usam todas as três variações da string de "
2816
+ "substituição. ::"
2801
2817
2802
2818
#: ../../howto/regex.rst:1199
2803
2819
msgid ""
@@ -2809,6 +2825,13 @@ msgid ""
2809
2825
">>> p.sub(r'subsection{\\ g<name>}','section{First}')\n"
2810
2826
"'subsection{First}'"
2811
2827
msgstr ""
2828
+ ">>> p = re.compile('section{ (?P<name> [^}]* ) }', re.VERBOSE)\n"
2829
+ ">>> p.sub(r'subsection{\\ 1}','section{First}')\n"
2830
+ "'subsection{First}'\n"
2831
+ ">>> p.sub(r'subsection{\\ g<1>}','section{First}')\n"
2832
+ "'subsection{First}'\n"
2833
+ ">>> p.sub(r'subsection{\\ g<name>}','section{First}')\n"
2834
+ "'subsection{First}'"
2812
2835
2813
2836
#: ../../howto/regex.rst:1207
2814
2837
msgid ""
@@ -2844,6 +2867,14 @@ msgid ""
2844
2867
">>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n"
2845
2868
"'Call 0xffd2 for printing, 0xc000 for user code.'"
2846
2869
msgstr ""
2870
+ ">>> def hexrepl(match):\n"
2871
+ "... \" Return the hex string for a decimal number\" \n"
2872
+ "... value = int(match.group())\n"
2873
+ "... return hex(value)\n"
2874
+ "...\n"
2875
+ ">>> p = re.compile(r'\\ d+')\n"
2876
+ ">>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n"
2877
+ "'Call 0xffd2 for printing, 0xc000 for user code.'"
2847
2878
2848
2879
#: ../../howto/regex.rst:1225
2849
2880
msgid ""
0 commit comments