我有一个数组,其中包含
<type 'list'>: [u'189,297', u'204,448', u'205,297',u'304,448',u'122,297', u'224,448']
欲望结果
list1
[u'203,448', u'204,448', u'230,448',, u'24,448', ]
list2
<type 'list'>: [ u'204,297', u'205,297', u'231,297', u'24,297']
我想分别将297和448的功能拆分为2个不同的数组或2个列表 在此先感谢
答案 0 :(得分:-1)
您可以尝试使用&#34; split&#34;方法:
import numpy as np
v =['189,297', '204,448', '205,297','304,448','122,297', '224,448']
m = np.zeros((len(v),2))
for i in range(len(v)):
m[i,:] = v[i].split(",")
m
array([[ 189., 297.],
[ 204., 448.],
[ 205., 297.],
[ 304., 448.],
[ 122., 297.],
[ 224., 448.]])