Reputation: 4921
I have to initialize a simple python dictionary as shown below:
dictionary = {
'a':'dftyj',
'b':'dftyj'+'__29July2021'
}
As you see dictionary['b']
is nothing but dictionary['a']
+ random string. I was wondering if I could use any sort of pointer to get value from the already existing properties of the dictionary?
Upvotes: 1
Views: 59
Reputation: 1546
That is not possible to do while you're creating the dictionary. You have to first create a dictionary and then get something out of it.
dictionary = {}
dictionary['a'] = 'dftyj'
dictionary['b'] = dictionary['a'] + '__29July2021'
Upvotes: 1