How to find a number in a string python?
📁 Advanced Python Topics
Need to find numbers in a string like
1A3BCF2BNKLOPY5T The built-in function is exactly what you need!
It returns tuples with the index and the next element:
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']>>> list(enumerate(seasons))[(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]Numbering can start from a specified number (0 by default):
Log in to leave an answer