因此stdin將一串文本返回到一個列表中,並且多行文本都是列表元素。 你如何將它們全部分成單個單詞?python如何分割列表中的文本
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']
謝謝你,這是完美的。更好的是,你已經勾畫出一個全新的Python概念供我學習。 – iFunction