glob.glob 匹配文件

>>>res_home = '/vip_data_center/test_envs/trainer/resource'
>>>model_name = 'caffe_models'
>>>nn_name = 'lenet'
>>>res_dir = os.path.join(res_home, model_name, nn_name)
>>>quantize_path = glob.glob(os.path.join(res_dir, '*.quantize'))
>>>quantize_path
['/vip_data_center/test_envs/trainer/resource/caffe_models/lenet/lenet_a.quantize']
>>>quantize_path = glob.glob(os.path.join(res_dir, '*.quantize'))[-1]
>>>quantize_path
'vip_data_center/test_envs/trainer/resource/caffe_models/lenet/lenet_a.quantize'

猜你喜欢

转载自www.cnblogs.com/sayiqiu/p/10594747.html