【发布时间】:2024-05-04 22:25:06
【问题描述】:
我正在尝试将数组导出到 txt 或 csv 文件。我一直在尝试使用 numpy,但我总是遇到一些错误,例如
TypeError: Mismatch between array dtype ('<U14') and format specifier ('%.18e')
这是我没有 numpy 的代码,效果很好,但我需要有关如何导出它的部分帮助。
peoples = []
for content in driver.find_elements_by_class_name('x234'):
people = content.find_element_by_xpath('.//div[@class="zstrim"]').text
if people != "Django" and people != "Rooky" :
pass
peoples.append([people, 1, datetime.now().strftime("%d/%m/%y %H:%M")])
print(peoples)
确实需要一些帮助。
【问题讨论】:
-
为什么你尝试使用 numpy(线性代数库)而不是 python standart library for reading and writing csv?
-
@Arnial 怎么样?你有代码建议如何在你的路上做到这一点?