TypeError: 'coroutine' object is not subscriptable | Python3

TypeError: 'coroutine' object is not subscriptable | Python3

▶️代码:

photos = client.get_profile_photos("me")

await client.delete_profile_photos([p.file_id for p in photos[1:]])

▶️ 输出/回溯:

Traceback (most recent call last):
  File "/plugins/code_runner.py", line 44, in eval
    await aexec(cmd, client, message)
  File "/plugins/code_runner.py", line 71, in aexec
    return await locals()["__aexec"](client, message)
  File "<string>", line 4, in __aexec
TypeError: 'coroutine' object is not subscriptable

我试过很多次了,例如:

(await client.delete_profile_photos([p.file_id for p in photos[1:]]))

await client.delete_profile_photos([async p.file_id for p in photos[2:]])

还有更多,

但是我想不通,我是菜鸟所以我希望有人能帮助我..

您还没有 await 拨打第一个电话,get_profile_photos。所以是协程,不是结果。