Here is the sample dict one
one = {'a': 1,'b': 3}
and the second dict is
second = {'x': 45,'y': 45}
here is the key container(of type list)
key_con = one.keys()
key_con = key_con.extend(second.keys())
and all work good.
But i try to shorten the code
like this
key_con = one.keys().extend(second.keys())
now, key_con is NoneType
i want to make this key container in one line code.
how to achieve it?
extendmodifies the list in-place and doesn’t return anything. Are you sure your first snippet works?