Python – Can't combine two dictionaries
Question:
Below this line of text is my code. Please see below. Python 3.11.
d = test_login('poo', 'poo')
a = test_login('doo', 'doo')
big_d = d | a
print(big_d)
It is only printing the a
dict. But if I specifically print d
, there is data.
Answers:
If d
and a
are dictionaries then :
d = {'poo': 'poo'}
a = {'doo': 'doo'}
print(d | a)
{'poo': 'poo', 'doo': 'doo'}
Below this line of text is my code. Please see below. Python 3.11.
d = test_login('poo', 'poo')
a = test_login('doo', 'doo')
big_d = d | a
print(big_d)
It is only printing the a
dict. But if I specifically print d
, there is data.
If d
and a
are dictionaries then :
d = {'poo': 'poo'}
a = {'doo': 'doo'}
print(d | a)
{'poo': 'poo', 'doo': 'doo'}