s = (
    """<alpha.Customer[cus_Y4o9qMEZAugtnW] active_card=<alpha.AlphaObject[card] ...>, created=1324336085, description='Customer for My Test App', livemode=False>"""
    )
val = s.split('[', 1)[1].split(']')[0]
Get the string within brackets in Python