fork download
  1. import re
  2.  
  3. ip = "{kevin.knerr, sam.mcgettrick, mike.grahs}@google.com.au"
  4. arr = re.match(r"\{([^\}]+)\}(\@\S+$)", ip)
  5.  
  6. #Using split for solution
  7.  
  8. for x in arr.group(1).split(","):
  9. print (x.strip() + arr.group(2))
  10.  
  11. #Regex Based solution
  12.  
  13. arr1 = re.findall(r"([^, ]+)", arr.group(1))
  14. for x in arr1:
  15. print (x + arr.group(2))
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
kevin.knerr@google.com.au
sam.mcgettrick@google.com.au
mike.grahs@google.com.au
kevin.knerr@google.com.au
sam.mcgettrick@google.com.au
mike.grahs@google.com.au