I have a directory with a large number of files. The file names are similar to the following: the(number)one(number), where (number) can be any number. There are also files with the name: the(number), where (number) can be any number. I was wondering how I can count the number of files with the additional "one(number)" at the end of their file name.
Let's say I have the list of file names, I was thinking of doing
for n in list:
if n.startswith(the(number)one):
add one to a counter
Is there anyway for it to accept any number in the (number) space when doing a startswith?
Example: the34one5 the37one2 the444one3 the87one8 the34 the32
This should return 4.