Skip to content

19th November 2021




Python Snippets

  • New: Remove a substring from the end of a string.

    On Python 3.9 and newer you can use the removeprefix and removesuffix methods to remove an entire substring from either side of the string:

    url = ''
    url.removesuffix('.com')    # Returns 'abcdc'
    url.removeprefix('abcdc.')  # Returns 'com'

    On Python 3.8 and older you can use endswith and slicing:

    url = ''
    if url.endswith('.com'):
        url = url[:-4]


  • New: Field customization.

    Optionally, the Field function can be used to provide extra information about the field and validations. Such as the title, default, description and many others


  • New: Introduce the Tenacity python library.

    Tenacity is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.