This is a convoluted example, but it shows what I'm attempting to do. Say I have a string:
from string import ascii_uppercase, ascii_lowercase, digits
s = "Testing123"
I would like to replace all values in s that appear in ascii_uppercase with "L" for capital letter, all values that appear in ascii_lowercase with "l" for lowercase letter, and those in digits with "n" for a number.
I'm currently doing:
def getpattern(data):
    pattern = ""
    for c in data:
        if c in ascii_uppercase: pattern += "L"; continue
        if c in ascii_lowercase: pattern += "l"; continue
        if c in digits: pattern += "n"; continue
        pattern += "?"
However, this is tedious with several more lists to replace. I'm usually better at finding map-type algorithms for things like this, but I'm stumped. I can't have it replace anything that was already replaced. For example, if I run the digits one and replace it with "n", the next iteration might replace that with "l" because "n" is a lowercase letter.
getpattern("Testing123") == "Lllllllnnn"
 
     
     
     
    