严重问题怎么解决?
import matplotlib.pyplot as plt
import seaborn as sns; sns.set(style="ticks", color_codes=True)
iris = sns.load_dataset("iris")
pg1 = sns.pairplot(iris[1::2], hue="species", corner=True)
pg2 = sns.pairplot(iris[::2], hue="species", corner=False, diag_kind=None))
# remove lower triangle and diagonal from figure 2
for ax in pg2.fig.get_axes():
if ax.get_geometry()[2] in [1,5,6,9,10,11,13,14,15,16]:
ax.remove()
# add all axes from figure 1 (lower triangle and diagonal) to figure 2
for ax in pg1.fig.get_axes():
ax.figure = pg2.fig # in the next step we can only add axes from the same figure
pg2.fig.add_axes(ax)
# close figure 1 which is not needed anymore
plt.close(pg1.fig)
给出错误:
command.MissingRole(missing_role)错误处理
答案 0 :(得分:0)
isinstance
仅可以告诉error
是否是MissingRole
对象,如果它代表特定的缺少角色,则不能。您应该将其分开作为自己的支票
@say.error
async def say_error(ctx, error):
if isinstance(error, commands.MissingRole):
if error.missing_role.id == 730356075689410570:
await ctx.send(f'`You dont have {error.missing_role} role..')
else:
await ctx.send("You are missing some other role")
else:
raise error # if we can't handle the error, bubble it back up