I want to print a table mixed with string and float values, as tab delimited output printout. Sure I can get the job done:
>>> tab = [['a', 1], ['b', 2]]
>>> for row in tab:
... out = ""
... for col in row:
... out = out + str(col) + "\t"
... print out.rstrip()
...
a 1
b 2
But I have a feeling there is a better way to do it in Python, at least to print each row with specified delimiter, if not the whole table. Little googling (from here) and it is already shorter:
>>> for row in tab:
... print "\t".join([str(col) for col in row])
...
a 1
b 2
Is there still a better, or more Python-ish, way to do it?