您也可以使用map函数:>>> map(str.split, listone)
[['Every', 'day', 'Miss', 'Leeson', 'went', 'out', 'to', 'work'], ['At', 'night', 'she', 'brought', 'home', 'papers', 'with', 'handwriting', 'on', 'them', 'and', 'made', 'copies', 'with', 'her', 'typewriter'], ['Sometimes', 'she', 'had', 'no', 'work', 'at', 'night,', 'and', 'then', 'she', 'would', 'sit', 'on', 'the', 'steps', 'of', 'the', 'high', 'stoop', 'with', 'the', 'other', 'roomers'], ['Miss', 'Leeson', 'was', 'not', 'intended', 'for', 'a', 'sky-light', 'room', 'when', 'the', 'plans', 'were', 'drawn', 'for', 'her', 'creation'], ['She', 'was', 'gay-hearted', 'and', 'full', 'of', 'tender,', 'whimsical', 'fancies'], ['Once', 'she', 'let', 'Mr'], ['Skidder', 'read', 'to', 'her', 'three', 'acts', 'of', 'his', 'great', '(unpublished)', 'comedy,', '"It']]
然后用你的过滤函数链接它(在本例中,选择3个随机单词)
^{pr2}$
(或者,通过列表理解:)>>> [random.sample(x.split(), 3) for x in listone]