How to print a word thats in a string thats in a list? in Python -


i'm new python , appreciate help. part of larger function trying call word string in list. here's example came with:

words = ['i sam', 'sam am', 'green eggs , ham']

for x in words:     y in x:         print(y) 

this prints every character:

i  m  s m  s m   m... etc. 

but want every word(the spaces not matter):

i sam  sam am....etc. 

 try this:  x in words:     y in x.split(' '):         print y  

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -