[Baypiggies] Fwd: manipulating lists question

Vikram K vikthirtyfive at gmail.com
Thu Dec 5 10:09:23 CET 2013


yes i am sure. another option could have been to obtain a dictionary like
so:

>>> x
[['cat', 'NM123', 12], ['cat', 'NM234', 12], ['dog', 'NM56', 65]]

>>> zee
{'dog': ['NM56', 65], 'cat': ['NM123,NM234', 12]}

---
The problem is to go from x to zee.




On Thu, Dec 5, 2013 at 3:53 AM, Michiel Overtoom <motoom at xs4all.nl> wrote:

>
> On Dec 5, 2013, at 09:06, Vikram K wrote:
>
> > Any suggestions on what i have to do to go from x to y?
> >
> > >>> x = [['cat','NM123',12],['cat','NM234',12], ['dog', 'NM56',65]]
> > >>> y = [['cat','NM123, NM234', 12], ['dog', 'NM56', 65]]
>
> Are you sure you mean
>
>   [['cat','NM123, NM234', 12], ['dog', 'NM56', 65]]
>
> and not
>
>   [['cat','NM123', 'NM234', 12], ['dog', 'NM56', 65]]
>
> ?
>
>
> > >>>
> >
> > Regards
> > Vik
> > _______________________________________________
> > Baypiggies mailing list
> > Baypiggies at python.org
> > To change your subscription options or unsubscribe:
> > https://mail.python.org/mailman/listinfo/baypiggies
>
>
> --
> Veel spullen zijn tegenwoordig waardeloos, maar toch hecht men er veel
> waarde aan. Mensen hebben vaak teveel spullen. Hoe komt dat en wat doe je
> ertegen? - een essay van Paul Graham, op
> http://www.michielovertoom.com/articles/paul-graham-spullen
>
> "Een prima telefoon met draaischijf weggooien? Die zou ik nog wel eens
> nodig kunnen hebben!"
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20131205/3c6ddbba/attachment.html>


More information about the Baypiggies mailing list