You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从SelectionItem获取文本?遇AttributeError报错求助(OneLineAvatarListItem场景)

解决方法
  • SelectionItem是列表项的包装对象,需先通过content属性获取内部的OneLineAvatarListItem实例
  • 再通过实例的text属性获取文本,示例代码如下:
# 假设selected_item是获取到的SelectionItem实例
list_item = selected_item.content
item_text = list_item.text
  • 如果上述方法无效,可直接访问内部的文本控件获取内容:
item_text = list_item.primary_text.text

内容的提问来源于stack exchange,提问作者ana iraqi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 08:45:35