python join equivalent -


i have dictionary say..

dict = {     'a' : 'b',     'c' : 'd' } 

in php implode ( ',', $dict ) , output 'a,b,c,d' how do in python?

this seems easiest way:

>>> itertools import chain >>> = dict(a='b', c='d') >>> ','.join(chain(*a.items())) 'a,b,c,d' 

Comments