comparison trafficintelligence/utils.py @ 1089:10205bd0e0b7

corrected bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 05 Dec 2018 16:58:54 -0500
parents 0680387a89bb
children 7594802f281a
comparison
equal deleted inserted replaced
1088:0680387a89bb 1089:10205bd0e0b7
1055 def listfiles(dirname, extension, remove = False): 1055 def listfiles(dirname, extension, remove = False):
1056 '''Returns the list of files with the extension in the directory dirname 1056 '''Returns the list of files with the extension in the directory dirname
1057 If remove is True, the filenames are stripped from the extension''' 1057 If remove is True, the filenames are stripped from the extension'''
1058 d = Path(dirname) 1058 d = Path(dirname)
1059 if d.is_dir(): 1059 if d.is_dir():
1060 tmp = [str(f) for f in d.glob('*.extension')] 1060 tmp = [str(f) for f in d.glob('*.'+extension)]
1061 if remove: 1061 if remove:
1062 return [removeExtension(f, extension) for f in tmp] 1062 return [removeExtension(f, extension) for f in tmp]
1063 else: 1063 else:
1064 return tmp 1064 return tmp
1065 else: 1065 else: