David,
Yep, use [::-1] operator ([:] operator with a negative step):
l=[1,2,3,4]
for i in l[::-1]:
print i
4
3
2
1
Explanation in the Python library doc: http://docs.python.org/lib/typesseq.html
The Python doc (http://docs.python.org/) is very useful. Most of the
time, the thing you are looking for are either in the Language
Reference (http://docs.python.org/ref/ref.html) or in the Library
Reference (http://docs.python.org/lib/lib.html).
Yes thanks for the info. I was mostly looking at
http://docs.python.org/tut/tut.html
BTW, please note that there is no guarantee of the demexp server to
sort the list in a specific order (the current reverse order comes
from the current sequence of processing in the server, that might
change in the future). Each question contains its question number
(parameter q_id, qu['q_id'] in your code) and you should sort the list
according to that.
Yes, I was thinking about that. There is also a method to retrieve
questions by their IDs, right? Do you have any comments on which method
is preferable? (or not)
Lyu.
_______________________________________________
Demexp-dev mailing list
Demexp-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/demexp-dev