I have a list which consists of lines as
lines = [\'The query complexity of estimating weighted averages.\',
\'New bounds for the query complexity of a
You can use a list comprehension:
>>> lines = [
... 'The query complexity of estimating weighted averages.',
... 'New bounds for the query complexity of an algorithm that learns',
... ]
>>> [word for line in lines for word in line.split()]
['The', 'query', 'complexity', 'of', 'estimating', 'weighted','averages.', 'New', 'bounds', 'for', 'the', 'query', 'complexity', 'of', 'an', 'algorithm', 'that', 'learns']