标题写不下了,数据类型报错TypeError: can only concatenate tuple (not "str") to tuple
运行的时候一直报错,我不知道问题出在了哪里,可能是input_type的问题。我也不知道应该怎么解决,有人可以帮我看看吗?截取的这段代码的最后一行是出现错误的那行。用的好像是python3.8
(不知道我截的这段能看出问题吗,如果还需要看更多我再发文件或者截取更多)
# determine which array(s) to extract from npz files
if input_type == 'ensemble_full':
npfile_to_extract = ('xa_ens',)
elif input_type == 'ensemble_subsample':
npfile_to_extract = ('xa_subsample',)
elif input_type == ('ensemble_mean', 'ensemble_variance'):
npfile_to_extract = ('xam', 'xav')
elif input_type == 'ensemble_mean':
npfile_to_extract = ('xam',)
else:
print('ERROR: Non-valid option specified for input data type: %s' %input_type)
raise SystemExit(1)
# look for files corresponding to desired input_type
#listdirfiles = glob.glob(workdir+'/'+input_type+'_*')
listdirfiles = glob.glob(workdir+'/ensemble_*')
# including gmt_ensemble
listdirfiles.extend(glob.glob(workdir+'/gmt_ensemble.npz'))
# strip directory name, keep file name only
listfiles = [item.split('/')[-1] for item in listdirfiles]
# strip everything but variable name
listvars = [(item.replace(input_type+'_','')).replace('.npz','') for item in listfiles]