I have a list containing items that mirror file names. I would like to filter only the names that are contain only digits. I seem not to get it right. Even matching a a single digit seem not to be working. Am I the one not doing it right? Any leads or suggestions would be appreciated.
Sample of code:
import re
pattern = r"^\d.+[.]"
pattern2 = r'\d*'
a = ["1000.mp4", "test.mp4", "110082.mp4", "829873.m4a"]
for i in a:
if re.match(i, pattern):
print(i)