'Is there a way to create a custom dictionary in python
Hello I was wondering if there was an existing version of an idea I had where you can create a custom dictionary like so:
MyCustomDict = {'value':'values':'valued','value1':'value2':'value3'}
Then you can access all of the following like so
MyCustomDict['1'] # 'value'
MyCustomDict['1a'] # 'values'
MyCustomDict['1b'] # 'valued'
MyCustomDict['2'] # 'value1'
MyCustomDict['2a'] # 'value2'
MyCustomDict['2b'] # 'value3'
Then if they go over 26 elements they can be represented as uppercase. Is this already made and if not is it possible to create?
Solution 1:[1]
MyCustomDict = {'value':{'values':'valued'},
'value1':{'value2':'value3'}}
or
MyCustomDict = {'value':[values],
'value1':[v1, v2, v3]}
or
MyCustomDict = {'value':[{'value1':'valued'}, {'value2':'valued'}]}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Matheus Pozzobon |
