6 Python f-strings tips and tricks
Python's f-strings can do a lot more than you might expect. Learn a few useful tips and tricks in this quick guide.
The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.
Python's f-strings can do a lot more than you might expect. Learn a few useful tips and tricks in this quick guide.
Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.
Converts a given string into a list of words.
Converts a string to camelcase.
Using str.lstrip()
to strip a prefix from a string might not be exactly what you're looking for. Here's what you should use instead.
Converts the values of RGB components to a hexadecimal color code.
Checks if the a value is an empty sequence or collection.
Learn two ways to format a string in Python with this quick tip.
Converts an integer to its roman numeral representation. Accepts value between 1
and 3999
(both inclusive).
Takes any number of iterable objects or objects with a length property and returns the longest one.
Converts a string to kebab case.
Splits a multiline string into a list of lines.
Converts a string to snake case.
Converts a string to a URL-friendly slug.
Check if two iterables are permutations of each other.
Decapitalizes the first letter of a string.
Capitalizes the first letter of a string.
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Reverses a list or a string.
Here are two quick and elegant ways to check if a string is empty in Python.
Pads a string on both sides with the specified character, if it's shorter than the specified length.
Learn of the two different ways to convert strings to lowercase in Python and understand when you should use each one with this quick guide.
Oftentimes you might need to trim whitespace from a string in Python. Learn of three different way to do this in this short guide.
Checks if the given string is a palindrome.