iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > String Manipulation > Converting Code Sets Using a Dictionary |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
If your code sets are large, you can use a dictionary to map one set of codes to another. A dictionary is easier to update than a complicated conditional statement. The following example uses a dictionary to map locations to location codes:
To add a new location, all you need to do is add a new key-value pair to the dictionary:
|