Lars Kotthoff <[email protected]> writes:
Python […] I have to split the returned string, which is error-prone with comma separators (e.g. name in email address is of form Lastname, Firstname).
email_list = "Diaz, Marco <[email protected]>, [email protected], Marco Diaz <[email protected]>, [email protected]" addresses = [] current_address = "" for char in email_list: if char == ',' and '@' in current_address: addresses.append(current_address.strip()) current_address = "" else: current_address += char addresses.append(current_address.strip()) # Adding the last address print(addresses) ## prints ['Diaz, Marco <[email protected]>', '[email protected]', 'Marco Diaz <[email protected]>', '[email protected]']
_______________________________________________ notmuch mailing list -- [email protected] To unsubscribe send an email to [email protected]
