[Baypiggies] Another Python koan: modifying a list

Dirk Bergstrom dirk at otisbean.com
Wed Nov 16 21:41:19 CET 2011


At Wed, 16 Nov 2011 12:13:13 -0800,Filip Machi wrote:
> Those are both pretty clever. The following is not nearly so clever. I  
> think it's simpler because it uses just basic string and list  
> operations. I think it fulfills the requirement that "... the input  
> data can never have a comma otherwise."
>  >>> args = ["1", "2", "3,4", "5,6,7"]
>  >>> ",".join(args).split(",")
> ['1', '2', '3', '4', '5', '6', '7']

Ding! We have a winner!

Fil, the check for your prize is in the mail...

-- 
       --------------------------------------
      Dirk Bergstrom           krid at otisbean.com
             http://otisbean.com/


More information about the Baypiggies mailing list