Closed cclauss closed 4 years ago
This solution to https://github.com/AlessandroZ/LaZagne/issues/431#issuecomment-552210931 should work in both Python 2 and Python 3.
% python3
python3
>>> dic = {"A": 0} >>> dic_tmp = {"B": 1} >>> dict(dic.items() + dic_tmp.items()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items' >>> dict(list(dic.items()) + list(dic_tmp.items())) {'A': 0, 'B': 1}
% python2
python2
>>> dic = {"A": 0} >>> dic_tmp = {"B": 1} >>> dict(dic.items() + dic_tmp.items()) {'A': 0, 'B': 1} >>> dict(list(dic.items()) + list(dic_tmp.items())) {'A': 0, 'B': 1}
Cool, thanks a lot :+1:
This solution to https://github.com/AlessandroZ/LaZagne/issues/431#issuecomment-552210931 should work in both Python 2 and Python 3.
%
python3
%
python2