這是我當前的代碼裏面:的Python如何擺脫小寫的元素列表
def poisci_pare(besedilo):
sents = besedilo.split('.')
noviseznam = [sent.split() for sent in sents if sent]
return noviseznam
這將返回:
poisci_pare("You are cool Anna. Johnny and I.")
>>>output: [["You", "are", "cool", "Anna"], ["Johnny", "and", "I"]]
我怎麼會改變我的功能,因此它會刪除小寫單詞和只有大寫單詞的返回列表?比如我要做到這一點:
poisci_pare("You are cool Anna. Johnny and I.")
>>>output: [["You","Anna"], ["Johnny", "I"]]
這不起作用,因爲我必須在列表中有一個列表,我有[[「你」,「是」,「酷」,「安娜」]],我會如何繼續這樣做列出現有列表中的列表? – peroxy 2014-11-05 22:15:37