Problem in understanding Python list comprehensions

前端 未结 6 1006
情书的邮戳
情书的邮戳 2021-02-03 13:42

What does the last line mean in the following code?

import pickle, urllib                                                                                                 


        
6条回答
  •  心在旅途
    2021-02-03 13:52

    Andy's is a great answer!

    If you want to see every step of the loop (with line-breaks) try this out:

    for elt in data:
        for e in elt:
            print "e[0] == %s, e[1] == %d, which gives us:  '%s'" % (e[0], e[1], ''.join(e[1] * e[0]))
    

提交回复
热议问题