首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

一个关于MIME的有关问题

2012-04-27 
一个关于MIME的问题msg MIMEText(fp.read())msg[Subject] The contents of %s % textfilemsg[Fro

一个关于MIME的问题
msg = MIMEText(fp.read())
msg['Subject'] = 'The contents of %s' % textfile
msg['From'] = me
msg['To'] = you

msg的类型是instance

请问下为啥可以这样写 msg['subject'] msg难道是列表?

[解决办法]
看看手册The Python Language Reference 3.4节,了解一下类的一些特性...

[解决办法]
字典也可以的

热点排行