Linux mint 18 and python 3.6

I have a list of strings that contains slightly more than a million items. Each item is a string of 8 capital letters like so:

['MIBMMCCO', 'YOWHHOY', ...]

I need to check and see if the letters 'OFHCMLIP' are one of the items in the list but there is no way to tell in what order the letters will appear. So I can't just search for the string 'OFHCMLIP'. I just need to locate any strings that are made up of those letters no matter their order.

I suppose I could loop over the list and loop over each item using a bunch of if statements exiting the inner loop as soon as I find a letter is not in the string, but there must be a better way.

I'd appreciate hearing about a better way to attack this.

thanks,  Jim

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to