给定一个字符串列表,我试图操纵列表中的每个字符串。
列表为data[0]
import csv
data = []
with open('twomoon.csv','rb') as csvfile:
fd = csv.reader(csvfile, delimiter = ',')
for row in fd:
data.append(row)
listX, listY, flag = [], [], []
for z in data[0]:
for xy in z.split(','):
x, y = xy.strip('[] ').split(' ')
listX.append(float(x))
listY.append(float(y))
我收到Too many values to unpack
错误。