我有以下清单:
ip= ['a boy called me z there', 'what u doing b over there ', "come w me t the end']
我想从列表中的每个字符串中删除所有单个字母。
我已经尝试了以下方法,但是它不起作用:
x = [[w for w in c if (len(w)>1)] for c in ip]
I want to convert my ip
such that I get the following output op
:
op= ['boy called me there', 'what doing over there ', "come me the end']
当通过c迭代ip时,c变成了一个字符(例如,'a',','b,'o','y','',...)
因此,请尝试将每个句子按空格分开并计算长度。
示例代码在这里。
尝试