I need to finding the same character in two string.
One from open file, i get it using this and one from user input
Example :
x = raw_input('input x')
y = open('file.txt' , 'r')
y = y.read()
Assume we get the x = abcde and y = Compare
I need to find a situations where x == y
In the example first i need to find 'a' in y , and then 'b' , and etc,
I dont need to find all string that same, only sequentially from the first till last.
From my example we can guess that after 'a' there will be no 'b' in the y,
So its okay, i dont need to find the 'e' as in y have 'e'.
Not 100% clear on the question, but this might help you get on track.
x = raw_input('input x')
with open('file.txt', 'r') as thefile:
for char in x:
if char in thefile:
print 'found character', char, 'in the file.'