我有以下字典:
# a small DB of people who stole my books
dic = {
'Cohen' : 'Calvino' 'Evertt' 'Borges',
'Larry' : 'The Bible',
'Volanski' : 'Phone Book'
}
# here's an abortive attempt to print it in a CSV format
for k in dic.keys():
print (k, '\t')
for v in dic.keys():
print (dic[v], ' ')
这是丑陋的输出:
Volanski
Phone Book
CalvinoEverttBorges
The Bible
Cohen
Phone Book
CalvinoEverttBorges
The Bible
Larry
Phone Book
CalvinoEverttBorges
The Bible
这就是我希望输出的样子:
Cohen Larry Volanski
Calvino The Bible Phone Book
Evertt
Borgest
(只有制表符分隔,我没有在这里展示)