If you work with strings in your Python scripts and you're writing obscure logic to process them, then you need to look into regex in Python. It lets you describe patterns instead of writing ...
Regular expressions are sequences of characters that form a search pattern. They are extremely useful for extracting information from text such as code, files, log, spreadsheets, or even documents.
# Regular expressions (called REs, or regexes, or regex patterns) are essentially a tiny, highly specialized programming language embedded inside Python # and made available through the re module.