根据下面引用的文档,消息应包含 MessagePart,而 MessagePart 又应包含 MessagePartBody。
https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message
当我运行下面的代码时(这只是此处找到的示例脚本的修改版本,其中消息替换为标签)
from __future__ import print_function
import pickle
import os.path
import openpyxl
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://mail.google.com/']
def main():
"""Shows basic usage of the Gmail API.
Lists the user's Gmail labels.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization …Run Code Online (Sandbox Code Playgroud) 我正在尝试更改 seaborn 折线图上 x 轴标签的旋转。然而,当我运行下面的代码时,我只得到一个大列表作为输出和一个没有 x 标签的图表:
sns.set(rc={'figure.figsize':(15,5)})
chart = sns.lineplot(y = top_deaths['Deaths'], x = top_deaths['Date'], data = top_deaths, hue ='Country/Region')
x = chart.get_xticklabels()
chart.set_xticklabels(x, rotation = 45)
[Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, 0, ''),
Text(0, …Run Code Online (Sandbox Code Playgroud)