I have a list:
my_list = [\'abc-123\', \'def-456\', \'ghi-789\', \'abc-456\']
and want to search for items that contain the string \'
\'
I am new to Python. I got the code below working and made it easy to understand:
my_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] for str in my_list: if 'abc' in str: print(str)