如何将文件导入python?

How to import documents into python?

我在 Sharepoint 中存储了一些非结构化数据,我想将它们导入到 python 环境中以进行文本分类。

但是,我不确定如何实现。我找到了一个名为 sharepoint (from sharepoint import SharePointSite, basic_auth_opener) 的库,但不确定如何使用它来将文件读入 python.

我找不到任何有用的资源来实现这一目标。任何人都可以帮助我解决这个问题,或者指导我找到任何有做同样事情的例子的来源吗?

@user86907,

我为 SharePoint 推荐一个 python 库 'shareplum',它很容易连接到 SPO/SP 服务器并获取 list/library 数据。

下载文件:

from shareplum import Site
from shareplum import Office365
from shareplum.site import Version

authcookie = Office365(base_path, username=username, password=password).GetCookies()
site = Site('https://my.sharepoint.com/sites/s01',version=Version.v365, authcookie=authcookie)

folder = site.Folder('Shared Documents/This Folder')
folder.get_file('source.txt')

BR