【发布时间】:2015-01-02 06:26:09
【问题描述】:
这是我当前的代码:
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"]]
【问题讨论】: