Posts in 2024
Get the IP address of a network interface by its name in Python on Linux an Mac OS X
Last Update: in Python
How to get the IP address of a network interface by its name in Python on Linux and Mac OS X
Get the IP address of a network interface by its name in Python, on Linux To get the IP address of a network interface by its name in Python, you can use the socket and fcntl modules. Here’s a step-by-step approach: Import the necessary …
Posts in 2023
How to Parse URLs in Python: A Comprehensive Guide with Examples
Last Update: in Python
How to Parse URLs in Python: A Comprehensive Guide with Examples
Parsing URLs (Uniform Resource Locators) is a common task in web development and data processing. URLs are the addresses that identify resources on the internet, such as web pages, images, and documents. Python provides powerful libraries and tools …
Posts in 2022
Python: How to print literal curly brace { or } in f-string and format string
Last Update: in Python
How to print literal curly brace “{” or “}” in f-string and format string. how to escape brace properly in python.
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 delimited by curly braces {}. While other string literals always …
Posts in 2020
Python unicode string lowercase and caseless match
in Python
str.lower()
andstr.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 …