word[0].split()
b = []
for i in range(len(a)):
if a[i] != 'is':
b.append(a[i])
b
先把word里的单词split成一个个字符串,然后再建立一个新的列表,每个word里面的元素判断是否是'is'如果是的话就不放进新的列表,如果不是的话就放进新的列表
b
Out[92]:
['+1',
'This',
'book',
'such',
'a',
'life',
'saver.',
'It',
'has',
'been',
'so',
'helpful',
'to',
'be',
'able',
'to',
'go',
'back',
'to',
'track',
'trends,',
'answer',
'pediatrician',
'questions,',
'or',
'communicate',
'with',
'each',
'other',
'when',
'you',
'are',
'up',
'at',
'different',
'times',
'of',
'the',
'night',
'with',
'a',
'newborn.',
'I',
'think',
'it',
'one',
'of',
'those',
'things',
'that',
'everyone',
'should',
'be',
'required',
'to',
'have',
'before',
'they',
'leave',
'the',
'hospital.',
'We',
'went',
'through',
'all',
'the',
'pages',
'of',
'the',
'newborn',
'version,',
'then',
'moved',
'to',
'the',
'infant',
'version,',
'and',
'will',
'finish',
'up',
'the',
'second',
'infant',
'book',
'(third',
'total)',
'right',
'as',
'our',
'baby',
'turns',
'1.',
'See',
'other',
'things',
'that',
'are',
'must',
'haves',
'for',
'baby',
'at',
'[...]'] |