使用 Python 和 REST api 从 Sharepoint 中提取
Extracting from Sharepoint using Python and REST api
http://server/site/{0}/{1}/_api/web/lists/GetByTitle
中的{0}/{1}
是什么意思
这里用大括号('curly braces')表示字符串中的replacement fields:
假设你有这个字符串,
my_string = "http://server/site/{0}/{1}/_api/web/lists/GetByTitle"
在代码的后面,您可以使用字符串格式函数为此替换字段提供值。
>>> my_string.format("first", "second")
'http://server/site/first/second/_api/web/lists/GetByTitle'
此处 {0}
将替换为格式函数的第一个参数 (first
),{1}
将替换为格式函数的第二个参数 (second
)
{0}/{1}
应该是占位符。
http://server/site/{0}/{1}/_api/web/lists/GetByTitle
{0}/{1}
是什么意思
这里用大括号('curly braces')表示字符串中的replacement fields:
假设你有这个字符串,
my_string = "http://server/site/{0}/{1}/_api/web/lists/GetByTitle"
在代码的后面,您可以使用字符串格式函数为此替换字段提供值。
>>> my_string.format("first", "second")
'http://server/site/first/second/_api/web/lists/GetByTitle'
此处 {0}
将替换为格式函数的第一个参数 (first
),{1}
将替换为格式函数的第二个参数 (second
)
{0}/{1}
应该是占位符。