RSS

Posts in 2022

  • Python: How to print literal curly brace { or } in f-string and format string

    in Python

    How to print literal curly brace “{” or “}” in f-string and format string. how to escape brace properly in python.

    Formatted string literals or f-string introduced in Python 3.6. A formatted string literal or f-string is a string literal that is prefixed with ‘f’ or ‘F’. These strings may contain replacement fields, which are expressions …

    Read more

Posts in 2020

  • Python unicode string lowercase and caseless match

    in Python

    str.lower() and str.casefold()

    str.lower() and str.casefold() Starting with Python 3.0, strings are stored as Unicode. Python defined to two functions str.lower() and str.casefold() can be used to convert string to lowercase: str.lower() Return a copy of the string with all the …

    Read more