I am working through a database of names with possible duplicate entries and attempting to identify which we have two of, unfortunately the formatting is a bit less than optimal and some entries have their first name, middle name, last name or maiden names mashed into one string and some have just first and last.
I need a way to see if say 'John Marvulli' matches 'John Michael Marvulli' and be able to do an operation on those matches. However if you try:
>>> 'John Marvulli' in 'John Michael Marvulli'
False
It returns False. Is there an easy way to compare two strings in this manner to see if one name is contained in another?
You need to split the strings and look for the individual words:
>>> all(x in 'John Michael Marvulli'.split() for x in 'John Marvulli'.split())
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With