Asterisk in function call

前端 未结 3 2180
渐次进展
渐次进展 2020-11-22 17:28

I\'m using itertools.chain to \"flatten\" a list of lists in this fashion:

uniqueCrossTabs = list(itertools.chain(*uniqueCrossTabs))

how is

3条回答
  •  被撕碎了的回忆
    2020-11-22 17:49

    Just an alternative way of explaining the concept/using it.

    import random
    
    def arbitrary():
        return [x for x in range(1, random.randint(3,10))]
    
    a, b, *rest = arbitrary()
    
    # a = 1
    # b = 2
    # rest = [3,4,5]
    

提交回复
热议问题