- 1
How to compare two strings in python inside the characters example: input1 :xy and input 2:xyz output: z
Compare strings
3 Answers
+ 1
# You could use sets
x = 'abc'
y = 'abcf'
print(set(x) - set(y))
print(set(y) - set(x))
print(set(y) ^ set(x))
# are you looking for differences or symmetric differences?
0
Looking for comparing the characters in the string..Lisa
0
> Looking for comparing the characters in the string..
This doesn't answer my question.
Are you trying to find as substring in a string? Use the "in" operator.