How to split tuple in python -
how split tuple dictionary
dic = {('k30', 'k56'): 1}
to output in text file:
k30 k56 1
what tried is
for k,v in dic.items(): a,b = k.split(',') print >>f, a+'\t',b+'\t',v f.close()
but got error:
attributeerror: 'tuple' object has no attribute 'split'
you need not split can say
a,b = k
Comments
Post a Comment