import scipy.io as scio
dataFile = 'D:\\Users\\a\\Documents\\Tencent Files\\178026882\\FileRecv\\wiki.mat'
data = scio.loadmat(dataFile)
# print (type(data))
a = (data['wiki'][0][0])
# print(len(a))
# print(a[2][0])
# print('--------------------------------------------')
# print(a[3])
lable =[]
lable_sex =[]
# print(a[2][0][0])
for i in range(len(a[2][0])):
name = a[2][0][i]
sex = a[3][0][i]
name = list(name)
# print(name)
name_0 = str(name[0])
# print(type(name_0))
sex_float = str(sex)
# print(type(name[0]))
# print('full_path:',name[0],sex)
lable.append((name_0,sex_float))
# print('gender:',sex)
# print(lable)
# aaa = []
# print(lable)
for i in lable:
aaa = i
print(i[0])
print(i[1])
with open("lable2.txt", "a") as f: # 格式化字符串还能这么用!
f.write(i[0])
f.write(' ')
f.write(i[1])
f.write('\n')
附上wiki数据集相关
附上自己从wiki.mat中提取出来的标签
https://pan.baidu.com/s/1dGT6ghV
再附上wiki的数据集地址
网友评论