Thanks all for your help!
--
http://mail.python.org/mailman/listinfo/python-list
greenflame <[EMAIL PROTECTED]>:
> Roberto: I do not understand the first half of the last line of your
> code.
[mainlist[i - 1] for i in orderinglist] is a list made with the
elements of orderinglist, but instead of taking the actual value i
from the list, the value that is taken is mainlist[i - 1
greenflame wrote:
> Thank you all for your replies. The only thing is I do not understand
> how the code is working. The following are more particular questions.
Actually, these are statements, not questions. But anyways:
> Travis: Iam sorry, but I do not know what list comprehension is.
> Robert
Thank you all for your replies. The only thing is I do not understand
how the code is working. The following are more particular questions.
Travis: Iam sorry, but I do not know what list comprehension is.
Roberto: I do not understand the first half of the last line of your
code. Also thank you for
greenflame wrote:
> Suppose the main list is: mainlist = list('qwertyuiop')
> Suppose the ordering list is: orderinglist = [3, 4, 2, 1]
>
> Then I am looking for a function that will take mainlist and
> orderinglist as arguments and return the following list:
>
> ['e', 'r', 'w', 'q', 't', 'y', 'u
3 Jun 2006 17:46:49 -0700, greenflame <[EMAIL PROTECTED]>:
> Suppose the main list is: mainlist = list('qwertyuiop')
>
> Suppose the ordering list is: orderinglist = [3, 4, 2, 1]
>
> Then I am looking for a function that will take mainlist and
> orderinglist as arguments and return the following li
greenflame wrote:
> I am trying to reorder elements of a list and I am stuck as to what
> might be the best way to approach this. I have a (main) list of
> elements and another (ordering) list (which is may shorter, but not
> longer than the main list) which contains the order in which I want the
I am trying to reorder elements of a list and I am stuck as to what
might be the best way to approach this. I have a (main) list of
elements and another (ordering) list (which is may shorter, but not
longer than the main list) which contains the order in which I want the
elements of the main list