From 28fb7b18811213d3156b5afaf6b5b1ccbeb4f7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 9 Jan 2020 19:50:49 +0100 Subject: [PATCH] Regex --- README.md | 6 +++--- index.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e4ed78b..36dd8aa 100644 --- a/README.md +++ b/README.md @@ -246,8 +246,8 @@ Type * **Type and class are synonymous.** ```python - = type() # Or: .__class__ - = isinstance(, ) # Or: issubclass(type(), ) + = type() # Or: .__class__ + = isinstance(, ) # Or: issubclass(type(), ) ``` ```python @@ -353,7 +353,7 @@ Regex import re = re.sub(, new, text, count=0) # Substitutes all occurrences with 'new'. = re.findall(, text) # Returns all occurrences as strings. - = re.split(, text, maxsplit=0) # Use brackets in regex to keep the matches. + = re.split(, text, maxsplit=0) # Use brackets in regex to include the matches. = re.search(, text) # Searches for first occurrence of the pattern. = re.match(, text) # Searches only at the beginning of the text. = re.finditer(, text) # Returns all occurrences as match objects. diff --git a/index.html b/index.html index aa591e6..71894d3 100644 --- a/index.html +++ b/index.html @@ -378,8 +378,8 @@ to_exclusive = <range>.stop
  • Everything is an object.
  • Every object has a type.
  • Type and class are synonymous.
  • -
    <type> = type(<el>)                            # Or: <el>.__class__
    -<bool> = isinstance(<el>, <type>)              # Or: issubclass(type(<el>), <type>)
    +
    <type> = type(<el>)                          # Or: <el>.__class__
    +<bool> = isinstance(<el>, <type>)            # Or: issubclass(type(<el>), <type>)
     
    @@ -459,7 +459,7 @@ to_exclusive = <range>.stop

    #Regex

    import re
     <str>   = re.sub(<regex>, new, text, count=0)  # Substitutes all occurrences with 'new'.
     <list>  = re.findall(<regex>, text)            # Returns all occurrences as strings.
    -<list>  = re.split(<regex>, text, maxsplit=0)  # Use brackets in regex to keep the matches.
    +<list>  = re.split(<regex>, text, maxsplit=0)  # Use brackets in regex to include the matches.
     <Match> = re.search(<regex>, text)             # Searches for first occurrence of the pattern.
     <Match> = re.match(<regex>, text)              # Searches only at the beginning of the text.
     <iter>  = re.finditer(<regex>, text)           # Returns all occurrences as match objects.