ra9ftm was kind enough to say:

> It is my first script on python. Don't know is it correctly uses
> modules, but it is working fine with specially with russian code pages
> and mime formated messages. Also quoted-printable and base64
> encoded....

Some hints:


1) don't write
"xxxxxxxxx",

use

"x" * 10 

instead; it's more readable and editable.

> def obrez(strMsg):
>     for s in subStrObrez:
>         n = string.rfind(strMsg,s)
>         if n != -1:
>             return strMsg[0:n]
>     return strMsg

In Python >= 2.5 you can probably use the partition() method to make the
former function much shorter.

> # Convert message header
> def my_get_header(str):
>     str2=""
>     for val,encoding in decode_header(str):
>         if encoding:
>             str2 = str2+ val.decode(encoding)+" "
>         else:
>             str2 = str2+ val+" "
>     return str2

I'm not 100% sure what you're doing there, BTW I'd suggest you to use as
many Unicode objects as you can while working in Python, and encoding them
just when you're outputting them. It'll save you many headaches.


-- 
Alan Franzoni <[EMAIL PROTECTED]>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to