python - Add a key with colon to a Counter -


i want add key counter object has several colon (:) characters inside. problem counter object adds key every character in key. example:

>>> cc = counter() >>> cc.update("1:2:3") >>> cc counter({':':2, '1':1, '2':1, '3':1}) 

i want counter counter({'1:2:3':1}). how can that?

insert dictionary counter update, this:

from collections import counter cc = counter() cc.update({"1:2:3":1}) print cc 'counter({'1:2:3': 1})' 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -