在 Python 中解析这些字符串的最佳方法是什么?

What is the optimal way to parse these strings in Python?

使用 Python 并给定以下 unique 项,找到与两个名称组合相匹配的对的最佳方法是什么?例如,如何找到与字符串 "BNBBTC" 对应的元组?

对于背景,右侧索引将只有 ~5 个选项(字符串长度为 3 或 4),而左侧索引可能有 >100 个。

(AMB, BNB),
(AMB, BTC),
(AMB, ETH),
(ARK, BTC),
(ARK, ETH),
(ARN, BTC),
(ARN, ETH),
(AST, BTC),
(AST, ETH),
(BAT, BNB),
(BAT, BTC),
(BAT, ETH),
(BCC, BNB),
(BCC, BTC),
(BCC, ETH),
(BCC, USDT),
(BCPT, BNB),
(BCPT, BTC),
(BCPT, ETH),
(BNB, BTC),
(BNB, ETH),
(BNB, USDT),
(BNT, BTC),
(BNT, ETH),
(BQX, BTC),
(BQX, ETH),
(BTC, USDT),
(BTG, BTC),
l = [('AMB', 'BNB'), ('AMB', 'BTC')]

d = dict()

for s in l:
    d[''.join(s)] = s


def find_name(key):
    return d[key] if d.get(key) else None


print(find_name('BNBBTC'))
l = [('AMB', 'BNB'), ('AMB', 'BTC'),('BNB', 'BTC')]

def find_name(key):
    for Touple in l:
        Flag = 0
        if (''.join(Touple)) == key: 
            Flag = 1
            break

    return Touple if (Flag == 1) else  False

print(find_name('BNBBTC'))