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.findall(r'\d+', '%s' %(filename))
to get a list containing the number, and use numbers[0] to get the number itself as a string... But if I know it is just one number, it seems roundabout and unnecessary making a list to get it. Is there another way to do this?
Edit: Thanks! I guess now I have another question. Rather than getting a string, how do I get the integer?