我只想读取位于 Onedrive 365 上的 Excel 文件。
我在网上阅读了很多资源,但没有任何效果!
我的实际代码是
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.file import File
url = 'https://yoursharepointsite.com/sites/documentsite'
username = 'yourusername'
password = 'yourpassword'
relative_url = '/sites/documentsite/Documents/filename.xlsx'
Run Code Online (Sandbox Code Playgroud)
import io
import pandas as pd
response = File.open_binary(ctx, relative_url)
#save data to BytesIO stream
bytes_file_obj = io.BytesIO()
bytes_file_obj.write(response.content)
bytes_file_obj.seek(0) #set file object to start
#read file into pandas dataframe
df = pd.read_excel(bytes_file_obj)
Run Code Online (Sandbox Code Playgroud)
我有以下错误
out>>> ModuleNotFoundError: No module named 'web'
Run Code Online (Sandbox Code Playgroud)
你有好主意吗 ?
我正在尝试从 youtube API 中的特定频道获取所有播放列表的列表...在 python 中,我希望在数组中包含 playlist_id 的列表
all_playlist_item = []
Run Code Online (Sandbox Code Playgroud)
这是此请求的响应
{
"kind": "youtube#playlistListResponse",
"etag": "PMwo-9BIp7p_L2ynH9sFOGIOido",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 17,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#playlist",
"etag": "-V67IpyB9a1JGDGJ4pVQnEoMRy4",
"id": "PLWi7PxnyAMeN1tb-ldDzJcnJy2yd5wYrO",
"snippet": {
Run Code Online (Sandbox Code Playgroud)
...
我想我必须使用 nextPageToken,但我不知道如何为播放列表项编写此函数
这是我的代码(在 Excel 中从特定播放列表中提取所有视频)
channel_name="UC1udnO-W6gpR9qzleJ5SDKw"
playlist_name="PLWi7PxnyAMeOJmVLv8Z_N3edNyipsnHbo"
api_key = "xxxxxx"
from apiclient.discovery import build
import pandas as pd
youtube = build('youtube', 'v3', developerKey=api_key)
def get_channel_videos(channel_id):
# get Uploads playlist id
res = youtube.channels().list(id=channel_id,
part='contentDetails').execute()
playlist_id = res['items'][0]['contentDetails']['relatedPlaylists']['uploads']
videos = [] …Run Code Online (Sandbox Code Playgroud)