On Wed, Oct 29, 2008 at 7:30 AM, W W <[EMAIL PROTECTED]> wrote:
> I'm trying to compare two strings because I want to find the difference.
Albert pointed you to zip so that you can iterate through the two
strings in lockstep. You may also want to investigate the python
difflib module in the stand
W W wrote:
Hi,
I'm trying to compare two strings because I want to find the difference.
i.e.
string1 = "foobar"
string2 = "foobzr"
is there a simple way to do this with a for loop? This is the method I
tried, but it gives me an error:
In [14]: for x, y in bar[0], bar[1]:
: print x,
On Wed, Oct 29, 2008 at 5:38 AM, A.T.Hofkamp <[EMAIL PROTECTED]> wrote:
>
> With the zip() function you can merge two sequences into one:
>
> for x, y in zip(string1, string2):
>print x, y
>
Ah! I *knew* there was a way - I just couldn't remember what it was.
Thanks!
-Wayne
Hi,
I'm trying to compare two strings because I want to find the difference.
i.e.
string1 = "foobar"
string2 = "foobzr"
is there a simple way to do this with a for loop? This is the method I
tried, but it gives me an error:
In [14]: for x, y in bar[0], bar[1]:
: print x, y
: