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

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -