python - 将列表附加到另一个列表中。'str' 对象没有属性 'append' 发生错误
问题描述
我创建了一个列表grapsedParts:
graspedParts = []
pickInfo = [robo.ActiveTool, part]
graspedParts.append(pickInfo)
但由于某种原因,它将被抓住的部分视为字符串而不是列表。它不断返回
AttributeError:“str”对象没有属性“append”
我用谷歌搜索了这个错误,并明白一个不能附加到一个 str 但我看不出我哪里出错了。任何帮助将不胜感激谢谢。
解决方案
尝试将 grabedParts 更改为列表,即
graspedParts = list()
推荐阅读
- apache - 使用带有 JBoss 的 mod_sed 附加空密码
- javascript - 如何在 MacOS 上的 Firefox 中不触发鼠标右键单击 Ctrl+LeftMouseClick?
- swift - SWIFT 中 NSMenu 项内的自定义视图
- docker - AWS EC2 如何在不受我控制的情况下自动重复编写“docker-compose up”?
- python - 如何在 Kali Linux 中安装 Python 3.6+ 版本?
- reactjs - React Ionic 中的复选框
- java - ActiveMQ:通过 JMX 获取网络连接列表?
- asp.net-mvc - 基于 MVC 中的角色或用户的授权
- excel - VBA 在 InputBox 之后显示 MsgBox
- c++ - 如何更改 vcproj 或 vcxproj 中 ProjectReference 标记的顺序?