【发布时间】:2018-07-10 19:56:13
【问题描述】:
从我读过的文章中,我必须像这样创建它:
fileList = np.array[("chris.txt", 2569437), ("terry.dat", 4596), ("mike.doc", 6593543),
("sarah.txt", 458667), ("david.ppt", 56437456), ("flyer.jpg", 4305),
("fred.png", 54966), ("randy_.ocx", 5968434), ("terry.dmg", 54485656)
("rick.exe", 4538565)]
但它给了我一个错误“'(str, int)' object is not callable”。我究竟做错了什么?我正在尝试做的事情是否可能?
【问题讨论】:
-
您必须用
()包围所有内容 -array接受单个值。您的错误是因为您在 3d 线上忘记了,。此外,Array 可能不是最适合此的类型 - 考虑使用字典。 -
你少了一个逗号。请删除您的问题。
-
你想要一个字符串数组,还是一个包含一个字符串字段和其他整数的结构化数组?
标签: python arrays python-2.7 numpy