On Fri, May 1, 2015 at 5:22 PM, Cecil Westerhof <ce...@decebal.nl> wrote: > On my system I have: > PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) > in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py > > In Python 3 that gives: > TypeError: unsupported operand type(s) for +: 'dict_keys' and > 'dict_values' > > How should I rewrite this?
The keys() and values() methods used to return lists, now they return views. If you explicitly listify them, it should work; alternatively, pipe-join each one separately and then pipe-join the result: PARSER_RE_STR = '/(%s|%s)=' % ('|'.join(DN_LUT.keys()), '|'.join(DN_LUT.values())) Note that this is slightly different from the above; in the case of an empty dict, the original produces empty parentheses, but my alternative will place a junk pipe in there. ChrisA -- https://mail.python.org/mailman/listinfo/python-list