Questions tagged «list-manipulation»

10
一些内置在python中填充列表的功能
我有一个尺寸小于N的清单我想用一个值将其填充到大小N。 当然,我可以使用类似以下的内容,但是我觉得应该缺少一些内容: >>> N = 5 >>> a = [1] >>> map(lambda x, y: y if x is None else x, a, ['']*N) [1, '', '', '', '']
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.