Verifying patterns of various filenames
This will make your example work in the same way you intended to.

patterns = []
patterns.append(lambda x: 'A' if x.isalpha() else x)
patterns.append(lambda x: '0' if x.isdigit() else x)

def get_pattern(name):
    for pattern in patterns:
        name = map(pattern, name)
    return ''.join(name)


Additionally you can register new patterns. Here is an example:

&gt;&gt;&gt; get_pattern('Mario Cesar 2013')
'AAAAA AAAAA 0000'


About your objective, if you want just to sanitize the file names, will be the best to use a different approach, look at https://github.com/ksze/sanitize