python pop3 收邮件
def retrive_emails(pop3_server, user_name, passwd, server_port):
#POP3
pop_client = poplib.POP3(pop3_server, port=server_port)
pop_client.user(user_name)
pop_client.pass_(passwd)
#print messages num
num_messages, mbox_size = pop_client.stat()
print 'there are %s new emails\n' % num_messages
if num_messages == 0:
pop_client.quit()
return
print('num of messages %s' %str(num_messages))
#mk folder
folder_name = '%s-%s' %(user_name, pop3_server)
if not os.path.exists(folder_name):
os.mkdir(folder_name)
for idx in range(num_messages):
one_mail = pop_client.retr(idx+1)
buf = cStringIO.StringIO()
for j in one_mail[1]:
print >>buf,j
buf.seek(0)
#parse mail content
msg = email.message_from_file(buf)
for part in msg.walk():
contenttype = part.get_content_type()
print('\npart:\n%s\n' % part)
&
相关文档:
由于工作需要,又要学习新的开发语言-Python, 语言学过几种了, 感觉还是有好多相似的地方, 这个Python感觉就跟Java有好多相通的地方, 首先你可以在Eclipse上通过配置后来开发Python。这里我听从了老大的建议,配置了一个FlexBuilder 作为Python的IDE进行开发。
目前刚开始学习Python的基本语法, 今天主要看了一下Pyth ......
Python http://www.python.org/download/ wxPython http://www.wxpython.org/download.php#binaries Vpython http://vpython.org/contents/download_windows.html Matplotlib http://sourceforge.net/projects/matplotlib/files/matplotlib/ PyGlet http://www.pyglet.org/download.html PyGame http://www.pyga ......
Memcached
是danga.com(运营LiveJournal的技术团队)开发的一套分布式内存对象缓存系统,用于在动态系统中减少数据库负载,提升性能。
网上有很多讲到Memcached For Linux的安装教程,但是Memcached For Win32 and Python的就甚少,偶尔google找到一篇
比较相近的英文教程,觉得 ......
代码+结果,不做解释
当然,对于python没有virtual function一说,估计当作对比一个例子看看吧。
#include <iostream>
using namespace std;
class base
{
public:
virtual void foo() { cout << "base" << endl; }
base() { foo() ;}
};
class derive: public base
{
pub ......
#coding=utf-8
from math import sqrt,cos,sin
import Image, ImageDraw
class SpireShape(object):
def __init__(self, draw):
self.draw = draw
self.line_width = 1
& ......