简体   繁体   English

如何将文档导入 python?

[英]How to import documents into python?

I have several unstructured data stored in sharepoint and I want to import them into python environment to do text classification.我有几个非结构化数据存储在 sharepoint 中,我想将它们导入 python 环境中进行文本分类。

However, I am not sure how to achieve this.但是,我不确定如何实现这一目标。 I found a library called sharepoint ( from sharepoint import SharePointSite, basic_auth_opener ) but not exactly sure how to use it to read in files into python.我找到了一个名为sharepoint的库( from sharepoint import SharePointSite, basic_auth_opener ),但不完全确定如何使用它将文件读入 python。

I couldn't find any useful resource to achieve this.我找不到任何有用的资源来实现这一目标。 Can anyone please help me on this, or direct me to any sources where there is an example of doing the same thing?任何人都可以帮我解决这个问题,或者将我引导到有做同样事情的例子的任何来源吗?

@user86907, @用户86907,

I recommend a python library 'shareplum' for SharePoint, it's easy to connect to SPO/SP server and fetch list/library data.我为 SharePoint 推荐一个 python 库“shareplum”,它很容易连接到 SPO/SP 服务器并获取列表/库数据。

Download file:下载文件:

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 BR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM