Mercurial Hosting > traffic-intelligence
comparison python/utils.py @ 185:c06379f25ab8
utilities for user types
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 25 Nov 2011 18:44:59 -0500 |
parents | 42142c5223ce |
children | 2788b2827670 |
comparison
equal
deleted
inserted
replaced
184:d70e9b36889c | 185:c06379f25ab8 |
---|---|
8 | 8 |
9 commentChar = '#' | 9 commentChar = '#' |
10 | 10 |
11 delimiterChar = '%'; | 11 delimiterChar = '%'; |
12 | 12 |
13 ######################### | |
14 # Enumerations | |
15 ######################### | |
16 | |
17 def inverseEnumeration(l): | |
18 'Returns the dictionary that provides for each element in the input list its index in the input list' | |
19 result = {} | |
20 for i,x in enumerate(l): | |
21 result[x] = i | |
22 return result | |
13 | 23 |
14 ######################### | 24 ######################### |
15 # CLI utils | 25 # CLI utils |
16 ######################### | 26 ######################### |
17 | 27 |