Skip to content
Snippets Groups Projects
Commit d8bd5311 authored by Jacques Grelet's avatar Jacques Grelet
Browse files

use dictionary comprehension

parent da7cba0e
No related branches found
No related tags found
No related merge requests found
......@@ -275,10 +275,8 @@ class Profile:
fileName_dict[int(station)] = file
else: # filename doesn't match regex
continue
# use list comprehension to reoder the dictionnary fileName_dict
for v in sorted(fileName_dict.keys()):
new_fileName_dict[v]= fileName_dict[v]
# [(fileName_dict[key]= value) for (key, value) in sorted(fileName_dict.items(), key=lambda x: x[1])]
# use dictionary comprehension to re-order the dictionnary fileName_dict
new_fileName_dict = { key:value for (key, value) in sorted(fileName_dict.items())}
else:
# we have to build a dictionary from the list of files
for i in range(1, len(self.fname)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment