Compare the paths to get the first different value
while i < len ( Path1 ) and i < len ( Path2 ) : NEW_LINE INDENT if Path1 [ i ] != Path2 [ i ] : NEW_LINE INDENT break NEW_LINE DEDENT i += 1 NEW_LINE DEDENT i -= 1 NEW_LINE j = i NEW_LINE