[triangle-zpug] how to match strings in python

Joseph Mack NA3T jmack at wm7d.net
Thu Apr 2 13:15:05 UTC 2009


I've looked in the string methods/functions in the python 
docs and I can't see how to do what I want, which is to 
find the parts of strings that match. eg


string_1 = "foobar"
string_2 = "foobaz"

matched_string = "fooba"

I need to walk along the string(s) 1 char at a time, 
accepting matching letters, till I get a mismatch, when the 
code exits. I was expecting to be able to retrieve chars one 
at a time from each of the two strings and test if the chars 
were the same.

How do I do this in python?

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the triangle-zpug mailing list