On May 30, 6:14 am, Ma Xiaojun <damage3...@gmail.com> wrote: > What interest me is a one liner: > print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in > range(1,10)]) for j in range(1,10)])
Ha,Ha! The join method is one of the (for me) ugly features of python. You can sweep it under the carpet with a one-line join function and then write clean and pretty code: #joinwith def joinw(l,sep): return sep.join(l) def mktable(m,n): return [[(j,i,i*j) for i in range(1,m+1)] for j in range(1,n+1)] def prettyrow(r): return joinw(['%d*%d=%d' % ele for ele in r],'\t') def prettytable(t): return joinw([prettyrow(r) for r in t],'\n') > I don't like code like this. But Python at least allow such practise. Are you saying VB etc disallow dirty code?? Dirty code is always possible in all languages. Of course the shape and size and smell of the dirt will differ -- http://mail.python.org/mailman/listinfo/python-list