【发布时间】:2017-10-20 12:04:09
【问题描述】:
所以stdin将一串文本返回到一个列表中,多行文本都是列表元素。 您如何将它们全部拆分为单个单词?
mylist = ['this is a string of text \n', 'this is a different string of text \n', 'and for good measure here is another one \n']
想要的输出:
newlist = ['this', 'is', 'a', 'string', 'of', 'text', 'this', 'is', 'a', 'different', 'string', 'of', 'text', 'and', 'for', 'good', 'measure', 'here', 'is', 'another', 'one']
【问题讨论】: