Lars Kotthoff <li...@larsko.org> 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 <m...@nachos.com>, s...@mewni.com, Marco
Diaz <m...@nachos.com>, s...@mewni.com" 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 <m...@nachos.com>', 's...@mewni.com', 'Marco
Diaz <m...@nachos.com>', 's...@mewni.com']
## (Trying again since use-hard-newlines borked the flow)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org