#-*- encoding: utf-8 -*-
import sys
import locale
import poplib
from email import parser
import email
import string
import mysql.connector
import traceback
import datetime
from mysql.connector import errorcode
import time
import re
reload(sys);
sys.setdefaultencoding('utf8');
# 确定运行环境的encoding
__g_codeset = sys.getdefaultencoding()
if "ascii"==__g_codeset:
__g_codeset = 'utf8';
#
def object2double(obj):
if(obj==None or obj==""):
return 0
else:
return float(obj)
#end if
#
def getMailIndex():
file = open('mailindex.txt',"r");
lines = file.readlines();
file.close();
return int(lines[0]);
#
def setMailIndex(index):
f = open('mailindex.txt', 'w');
f.write(index);
f.close();
#
def utf8_to_mbs(s):
return s.decode("utf-8").encode(__g_codeset)
#
def utf
python及时获得新邮件
于 2015-04-09 15:48:24 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)