Do you please know if it's possible in Python 3.7 to find in a list a certain word?
For example, in a list list = ['hello world', 'hello everyone', 'Freddy Krueger'] to make the program do an action only for the element with the word 'hello' inside of them.
Sorry for my bad english, I hope you will help me finding a solution.
Have a nice evening!
            Asked
            
        
        
            Active
            
        
            Viewed 456 times
        
    0
            
            
        - 
                    What if the list includes something like `'Othello'`? Should that be a match for `'hello'`, or do you want only whole words? And what about case-sensitivity? – ekhumoro Dec 04 '19 at 20:35
1 Answers
1
            
            
        quick and easy way is to iterate over each string in the list, and then check if that string contains the word hello
for string in list:
    if 'hello' in string:
        #do something
 
    
    
        swaggy p
        
- 337
- 1
- 8
