Skip to content

Commit

Permalink
Update Intro_Python.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ellesimas committed Dec 7, 2020
1 parent 3b481ac commit 3ca7bb9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions docs/source/Vitollino/Intro_Python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1491,11 +1491,16 @@ Retorna uma lista de strings contendo todas as correspondências.
.. code:: python
import re
string = "The rain in Spain falls maizly izamly zamily in the plain!"
pattern = 'a|i' #['a', 'i', 'i', 'a', 'i', 'a', 'a', 'i', 'i', 'a', 'a', 'i', 'i', 'a', 'i']
#pattern = 'e|a|i' #['e', 'a', 'i', 'i', 'a', 'i', 'a', 'a', 'i', 'i', 'a', 'a', 'i', 'i', 'e', 'a', 'i']
string = 'Ola! Eu tenho 26 anos e carrego 2 bolsas'
#pattern = '[aeiou]' # ['a', 'u', 'e', 'o', 'a', 'o', 'e', 'a', 'e', 'o', 'o', 'a']
#pattern = '[^aeiou]'#['O', 'l', '!', ' ', 'E', ' ', 't', 'n', 'h', ' ', '2', '3', ' ', 'n', 's', ' ', ' ', 'c', 'r', 'r', 'g', ' ', '2', ' ', 'b', 'l', 's', 's']
#pattern = '[a-c]' # ['a', 'a', 'c', 'a', 'b', 'a']
#pattern = '.....' # ['Ola! ', 'Eu te', 'nho 2', '3 ano', 's e c', 'arreg', 'o 2 b', 'olsas']
result = re.findall(pattern, string)
print(result)
* **re.split()**

Divide a string onde há correspondência e retorna uma lista de strings onde as divisões ocorreram.
Expand Down

0 comments on commit 3ca7bb9

Please sign in to comment.