python - 如何摆脱“numpy.ndarray”没有属性拆分?
问题描述
我尝试编辑一个 stl 文件。关于这一点,我使用 numpy-stl 读取了 stl 文件。现在,当我尝试拆分其中存在的行时,它向我显示一个错误:
“numpy.ndarray”对象没有属性“split”
如何克服这一点?下面是代码。
import numpy as np
import stl
from stl import mesh
lines = mesh.Mesh.from_file('mesh.stl')
count = 0
for line in lines:
if line.split()[0] == "solid":
repl = line.split()[1]
print(repl)
任何线索将不胜感激。
问候, Sunag R A.
解决方案
只需使用str(line)
替代tostring(line)
方法
推荐阅读
- c++ - 在 VS 代码中调试时无法打开“osteram.tcc”和“ios_base.h”
- python-3.x - 是否存在类似followin的东西?('''select * from TABLE where ? in FIELD''',(VAR))
- redis - redis如何分离运行在同一台服务器上的多个用户实例?
- node.js - 如何让用户在 nodejs / vuejs / postgres SaaS webapp 上安装预构建的应用程序,如 wordpress 插件
- machine-learning - 带有验证的 Sagemaker 随机森林砍伐训练
- css - 将 Tailwind 类转换为 css 内联样式
- java - 使用操作类型时,Spring Data Redis 中的 DI 如何工作?
- javascript - 会话不保存在快速会话中
- cassandra - 不允许过滤的 Cassandra 查询
- git - 无法解析主机:github.com