So I have a very interesting task ahead of me and it is to loop through an
email using the 'gmail dot trick'. Essentially this trick puts periods
throughout your email to make it look different. Even though it has periods
gmail will replace them all and send it to that email.

So [EMAIL PROTECTED] is the same as [EMAIL PROTECTED]

My task is this: Loop through an email and create as many combinations of
periods as possible. So all the combinations for blah would be:

b.lah
bl.ah
bla.h
b.l.ah
b.la.h
bl.a.h

I'm still rather new to python so this is turning out to be rather tricky.
My current code is as follows:

for d in range(1, len(email)):
>     for i in range(1, len(email)):
>         y = i
>         temail = email
>         for x in range(d):
>             if email[y] == '.': break
>             temail = temail.replace(email[y], '.' + email[y])
>             if not y > len(email) - 2: y += 1
>         print temail
>

It's not looking too bad except for some reason it's making emails like
bl..ah which is invalid. So can anyone help me out with getting this to
work? Thanks.

Cheers,
Josh
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to