python - 在python中打印名称后的文本
问题描述
如何打印数据中的所有名称?我试图将我的数据转换为 JSON,我似乎没有运气。
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
import csv
import json
import numpy as np
authcookie = Office365('https://bboxxeng.sharepoint.com/', username='', password='').GetCookies()
site = Site('https://bboxxeng.sharepoint.com/sites/TESTIAN', version=Version.v2016, authcookie=authcookie)
folder = site.Folder('Shared Documents/test')
#data = folder.get_file('Office ss E1.csv')
#folder = site.Folder('Shared Documents/test')
r = folder.files
print (r)
输出
[{'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/saaaaa.png')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/saaaaa.png')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{B1568967-0820-48B6-80B2-041CAC21B166},1,2', 'CustomizedPageStatus': 0, 'ETag': '"{B1568967-0820-48B6-80B2-041CAC21B166},1"', 'Exists': True, 'IrmEnabled': False, 'Length': '24383', 'Level': 1, 'LinkingUri': None, 'LinkingUrl': '', 'MajorVersion': 1, 'MinorVersion': 0, 'Name': 'saaaaa.png', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/saaaaa.png', 'TimeCreated': '2020-05-11T15:02:15Z', 'TimeLastModified': '2020-05-11T15:02:15Z', 'Title': None, 'UIVersion': 512, 'UIVersionLabel': '1.0', 'UniqueId': 'b1568967-0820-48b6-80b2-041cac21b166'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/xz.png')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/xz.png')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{245848AF-4533-4B9A-8AB8-1439480329F2},1,2', 'CustomizedPageStatus': 0, 'ETag': '"{245848AF-4533-4B9A-8AB8-1439480329F2},1"', 'Exists': True, 'IrmEnabled': False, 'Length': '30097', 'Level': 1, 'LinkingUri': None, 'LinkingUrl': '', 'MajorVersion': 1, 'MinorVersion': 0, 'Name': 'xz.png', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/xz.png', 'TimeCreated': '2020-05-11T15:43:58Z', 'TimeLastModified': '2020-05-11T15:43:58Z', 'Title': None, 'UIVersion': 512, 'UIVersionLabel': '1.0', 'UniqueId': '245848af-4533-4b9a-8ab8-1439480329f2'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/Office 365 E1.csv')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/Office%20365%20E1.csv')", 'CheckInComment': '', 'CheckOutType': 0, 'ContentTag': '{9BF05040-09BB-4534-B9C6-147AA72BD42D},1,1', 'CustomizedPageStatus': 0, 'ETag': '"{9BF05040-09BB-4534-B9C6-147AA72BD42D},1"', 'Exists': True, 'IrmEnabled': False, 'Length': '20347', 'Level': 255, 'LinkingUri': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared%20Documents/Test/Office%20365%20E1.csv?d=w9bf0504009bb4534b9c6147aa72bd42d', 'LinkingUrl': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared Documents/Test/Office 365 E1.csv?d=w9bf0504009bb4534b9c6147aa72bd42d', 'MajorVersion': 2, 'MinorVersion': 0, 'Name': 'Office 365 E1.csv', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/Office 365 E1.csv', 'TimeCreated': '2020-05-11T17:05:59Z', 'TimeLastModified': '2020-05-11T17:05:59Z', 'Title': None, 'UIVersion': 1024, 'UIVersionLabel': '2.0', 'UniqueId': '9bf05040-09bb-4534-b9c6-147aa72bd42d'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/xza.png')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/xza.png')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{A7D9C903-F789-4153-B9F5-5AE2E23DC6B9},2,3', 'CustomizedPageStatus': 0, 'ETag':
'"{A7D9C903-F789-4153-B9F5-5AE2E23DC6B9},2"', 'Exists': True, 'IrmEnabled': False, 'Length': '44496', 'Level': 1, 'LinkingUri': None, 'LinkingUrl': '', 'MajorVersion': 2, 'MinorVersion': 0, 'Name': 'xza.png', 'ServerRelativeUrl':
'/sites/TESTIAN/Shared Documents/Test/xza.png', 'TimeCreated': '2020-05-11T16:39:08Z', 'TimeLastModified': '2020-05-11T16:45:57Z', 'Title': None, 'UIVersion': 1024, 'UIVersionLabel': '2.0', 'UniqueId': 'a7d9c903-f789-4153-b9f5-5ae2e23dc6b9'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/saaaa.png')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/saaaa.png')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{95BE4EA4-525A-48C8-8DB7-712E494FB142},2,3', 'CustomizedPageStatus': 0, 'ETag': '"{95BE4EA4-525A-48C8-8DB7-712E494FB142},2"', 'Exists': True, 'IrmEnabled': False, 'Length': '24383', 'Level': 1, 'LinkingUri': None, 'LinkingUrl': '', 'MajorVersion': 2, 'MinorVersion': 0, 'Name': 'saaaa.png', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/saaaa.png', 'TimeCreated': '2020-05-11T14:49:15Z', 'TimeLastModified': '2020-05-11T14:56:56Z', 'Title': None, 'UIVersion': 1024, 'UIVersionLabel': '2.0', 'UniqueId': '95be4ea4-525a-48c8-8db7-712e494fb142'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/asas.csv')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/asas.csv')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{09CED0C9-2196-4DD2-BB2E-9CCCF1E01BC4},2,2', 'CustomizedPageStatus': 0, 'ETag': '"{09CED0C9-2196-4DD2-BB2E-9CCCF1E01BC4},2"', 'Exists': True, 'IrmEnabled': False, 'Length': '20347', 'Level': 1, 'LinkingUri': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared%20Documents/Test/asas.csv?d=w09ced0c921964dd2bb2e9cccf1e01bc4', 'LinkingUrl': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared Documents/Test/asas.csv?d=w09ced0c921964dd2bb2e9cccf1e01bc4', 'MajorVersion': 2, 'MinorVersion': 0, 'Name': 'asas.csv', 'ServerRelativeUrl': '/sites/TESTIAN/Shared
Documents/Test/asas.csv', 'TimeCreated': '2020-05-14T09:32:36Z', 'TimeLastModified': '2020-05-14T09:33:23Z', 'Title': None, 'UIVersion': 1024, 'UIVersionLabel': '2.0', 'UniqueId': '09ced0c9-2196-4dd2-bb2e-9cccf1e01bc4'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/saaaaaa.png')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/saaaaaa.png')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{73887AAD-B72D-4418-BB8D-A2F170C366FD},2,3', 'CustomizedPageStatus': 0, 'ETag': '"{73887AAD-B72D-4418-BB8D-A2F170C366FD},2"', 'Exists': True, 'IrmEnabled': False, 'Length': '24290', 'Level': 1, 'LinkingUri': None, 'LinkingUrl': '', 'MajorVersion': 2, 'MinorVersion': 0, 'Name': 'saaaaaa.png', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/saaaaaa.png', 'TimeCreated': '2020-05-11T15:13:43Z', 'TimeLastModified': '2020-05-11T15:24:24Z', 'Title': None, 'UIVersion': 1024, 'UIVersionLabel': '2.0', 'UniqueId': '73887aad-b72d-4418-bb8d-a2f170c366fd'}, {'odata.type': 'SP.File', 'odata.id': "https://bboxxeng.sharepoint.com/sites/TESTIAN/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared Documents/Test/hey.csv')", 'odata.editLink': "Web/GetFileByServerRelativePath(decodedurl='/sites/TESTIAN/Shared%20Documents/Test/hey.csv')", 'CheckInComment': '', 'CheckOutType': 2, 'ContentTag': '{562E8ED9-5E0F-42D1-A246-C2BA9C9906C0},1,1', 'CustomizedPageStatus': 0, 'ETag': '"{562E8ED9-5E0F-42D1-A246-C2BA9C9906C0},1"', 'Exists': True, 'IrmEnabled': False, 'Length': '20347', 'Level': 1, 'LinkingUri': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared%20Documents/Test/hey.csv?d=w562e8ed95e0f42d1a246c2ba9c9906c0', 'LinkingUrl': 'https://bboxxeng.sharepoint.com/sites/TESTIAN/Shared Documents/Test/hey.csv?d=w562e8ed95e0f42d1a246c2ba9c9906c0', 'MajorVersion': 1, 'MinorVersion': 0, 'Name': 'hey.csv', 'ServerRelativeUrl': '/sites/TESTIAN/Shared Documents/Test/hey.csv', 'TimeCreated': '2020-05-14T11:49:15Z', 'TimeLastModified': '2020-05-14T11:49:15Z', 'Title': None, 'UIVersion': 512, 'UIVersionLabel': '1.0', 'UniqueId': '562e8ed9-5e0f-42d1-a246-c2ba9c9906c0'}]
我的预期输出是打印所有名称,例如:xza.png
解决方案
尝试这个:
for data in r:
print(data['Name'])
就像访问字典中的数据一样
结果
saaaaa.png
xz.png
Office 365 E1.csv
xza.png
saaaa.png
asas.csv
saaaaaa.png
hey.csv
推荐阅读
- python - 尝试更新个人资料用户数据时出错
- java - 如果我将实例变量设置为私有,是否可以避免隐私泄露的风险?
- java - openapi - 不允许空格或连字符的正则表达式
- assembly - 遵循 ABI 进行模块本地调用的目的是什么?它甚至在哪里执行?
- javascript - 上传文件,然后将所有图像转换为 PDF
- java - 仅当浏览器在java中错误关闭时才保留会话数据
- python - 为什么在给定文本行中的数字时 IsNumeric() 返回 False
- sql-server - 如果我没有在连接中提供别名(不明确的列名“名称”),请尝试捕获无效
- grafana - 为 AddTextInput 启用多行
- mysql - prisma:乐观并发控制使用UpdateMany有问题