I have a file called something like FILE-1.txt or FILE-340.txt. I want to be able to get the number from the file name. I\'ve found that I can use
numbers = re.f
Use search instead of findall:
search
findall
number = re.search(r'\d+', filename).group()
Alternatively:
number = filter(str.isdigit, filename)