import difflib
def matches(first_string,second_string):
s = difflib.SequenceMatcher(None, first_string,second_string)
match = [first_string[i:i+n] for i, j, n in s.get_matching_blocks() if n > 0]
return match
first_string = "this is a sample string"
second_string = "this is also a sample string"
print matches(second_string, first_string )
aW1wb3J0IGRpZmZsaWIKCmRlZiBtYXRjaGVzKGZpcnN0X3N0cmluZyxzZWNvbmRfc3RyaW5nKToKICAgIHMgPSBkaWZmbGliLlNlcXVlbmNlTWF0Y2hlcihOb25lLCBmaXJzdF9zdHJpbmcsc2Vjb25kX3N0cmluZykKICAgIG1hdGNoID0gW2ZpcnN0X3N0cmluZ1tpOmkrbl0gZm9yIGksIGosIG4gaW4gcy5nZXRfbWF0Y2hpbmdfYmxvY2tzKCkgaWYgbiA+IDBdCiAgICByZXR1cm4gbWF0Y2gKCmZpcnN0X3N0cmluZyA9ICJ0aGlzIGlzIGEgc2FtcGxlIHN0cmluZyIKc2Vjb25kX3N0cmluZyA9ICJ0aGlzIGlzIGFsc28gYSBzYW1wbGUgc3RyaW5nIgpwcmludCBtYXRjaGVzKHNlY29uZF9zdHJpbmcsIGZpcnN0X3N0cmluZyAp