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.
Checks if the a value is an empty sequence or collection.
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 an integer to its roman numeral representation.
Accepts value between 1
and 3999
(both inclusive).
Learn two ways to format a string in Python with this quick tip.
Converts a string to kebab case.
Converts the values of RGB components to a hexadecimal color code.
Takes any number of iterable objects or objects with a length property and returns the longest one.
Splits a multiline string into a list of lines.
Converts a string to snake case.
Capitalizes the first letter of a string.
Decapitalizes the first letter of a string.
Converts a string to a URL-friendly slug.
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
Check if two iterables are permutations of each other.
Reverses a list or a string.
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.
Pads a string on both sides with the specified character, if it's shorter than the specified length.
Here are two quick and elegant ways to check if a string is empty in Python.
Checks if the given string is a palindrome.
Oftentimes you might need to trim whitespace from a string in Python. Learn of three different way to do this in this short guide.