Re: [PATCH] config: allow custom separators in author lists

Subject: Re: [PATCH] config: allow custom separators in author lists

Date: Fri, 22 Dec 2023 23:20:46 +0100

To: Lars Kotthoff, notmuch@notmuchmail.org

Cc:

From: Sandra Snan


Lars Kotthoff <lists@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>, star@mewni.com, Marco 
Diaz <m@nachos.com>, star@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>', 'star@mewni.com', 'Marco 
   Diaz <m@nachos.com>', 'star@mewni.com'] 

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: