I have a large number of images that were named in a odd way and because of that, when they're displayed in a file browser, they're completely out of order. However, since they weren't named in a completely random manner, I can use regex to properly rename them, once I understand all the subpatterns that went into it. So far I only understood two.

So I'm going to create a program to verify the pattern of each filename, make a set out of it with a sample of each name, and then try to understand the patterns and subpatterns.

```
def get_pattern(name):
    pattern = []
    for letter in name:
        if letter.isalpha():
            pattern.append('a')
        elif letter.isdigit():
            pattern.append('0')
        else:
            pattern.append(letter)
    return ''.join(pattern)

```

It's pretty straightforward to loop through the images and then check the pattern for each image.

My questions:

1. Is there a way to make the code more concise? Maybe using a dictionary?
2. Is there something in `re` or other easily available library that does this? Is using `isalpha()` and `isdigit()` the way to go here?