Python 3.x 在MAC中使用python提取.msg文件中的表计数和图像计数

Python 3.x 在MAC中使用python提取.msg文件中的表计数和图像计数,python-3.x,macos,outlook,email-attachments,win32com,Python 3.x,Macos,Outlook,Email Attachments,Win32com,我试图从python中的.msg文件中提取表计数、图像计数 我以前使用的是win32com包,它提供了预期的输出我试图在Mac中复制相同的功能,但无法找到相关的软件包以获得所需的输出 Windows中的工作代码: import win32com.client from bs4 import BeautifulSoup outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") msg = outlo

我试图从python中的.msg文件中提取表计数、图像计数

我以前使用的是win32com包,它提供了预期的输出我试图在Mac中复制相同的功能,但无法找到相关的软件包以获得所需的输出

Windows中的工作代码:

import win32com.client
from bs4 import BeautifulSoup
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
msg = outlook.OpenSharedItem(r"C:\\Users\\sowmiyan\\Sample.msg")


html = msg.HTMLBody
soup = BeautifulSoup(html )
tables = soup.findAll("table")
count_tables=len(tables)

count_attachments = msg.Attachments.Count
image_format_list=['png','jpg','tif','gif']
count_images = 0

if count_attachments > 0:
                for item in range(count_attachments):
                    if msg.Attachments.Item(item + 1).Filename.split(".")[-1] in image_format_list:
                        count_images+=1


print(count_tables)
print(count_images)
有没有人能提供一些指针,让它在MAC上运行