首页 > 编程语言 > 详细

[Python學習筆記] 抓出msg信件檔裡的附件檔案

时间:2015-10-20 11:46:20      阅读:278      评论:0      收藏:0      [点我收藏+]

想要把msg信件檔案的附件抓出來做處理,找到了這個Python 模組 msg-extractor

使用十分容易,但是這個模組是要在terminal裡執行,無法直接打在IDLE的編輯器上

所以稍微做了修改,使用 subprocess 模組來打指令就可以了

 

以下為程式碼 完整程式碼在我的 Github

 

 

#放置msg檔的檔案路徑 
srcfilePath=os.path.join(C:\\, Python2.7.10)
#msg 檔名
fileName=123.msg
def MsgToExcelDatabase(srcfilePath,fileName):
    MailmsgPath=os.path.join(srcfilePath,fileName)
    #使用 subprocess執行打command的動作
    #start extract attachment from 123.msg
    DIR = os.path.join(C:\\, Python2.7.10, msg-extractor-master, ExtractMsg.py)
    subprocess.call([python, DIR, MailmsgPath])

#把路徑與檔名放入寫好的 def
MsgToExcelDatabase(srcfilePath,fileName)

[Python學習筆記] 抓出msg信件檔裡的附件檔案

原文:http://www.cnblogs.com/vickychan222/p/4894122.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!