我有以下列表:
[['identificator', [6036971], [1112221]], ['gender', ['Male'], ['Female']]]
我怎样才能将单个元素列表变成普通元素,像这样?
[['identificator', 6036971, 1112221], ['gender', 'Male', 'Female']]
我将其用作 csv.writer.writerow 的输入,并将括号打印为字符串:-/
发生这种情况的代码在这里https://github.com/TheChymera/E2att/commit/4dd5e391b3ec7a4d630cef7c8c8fa803ede3e808#quest.py - 我遇到问题的变量是这样创建的:
def lefilter(keep=None):
data, filters, _ = get_data()
mask = filters[:,-1] == keep
lefilter = filters[mask][:,:-1]
value = data[:,lefilter.astype(np.bool)[0]]
if keep != 'gender':
value = value.astype(np.integer)
return value