You are looking at whole tuples with unicode strings; the u''
is normal when showing you a tuple with unicode values inside:
>>> print u'Hello World!'
Hello World!
>>> print (u'Hello World',)
(u'Hello World',)
You want to format each row:
print u' {:<15} {:<8} {:<6}'.format(*row)
See the str.format()
documentation, specifically the Format Syntax reference; the above formats 3 values with field widths, left-aligning each value into their assigned width.
The widths are approximate (I didn’t count the number of spaces in your post exactly), but should be easy to adjust to fit your needs.
Demo:
>>> row = (u'31/05/2013', u'11:10', u'$487')
>>> print u' {:<15} {:<8} {:<6}'.format(*row)
31/05/2013 11:10 $487
or, using a loop and a sequence of row entries:
>>> rows = [
... (u'31/05/2013', u'11:10', u'$487'),
... (u'31/05/2013', u'11:11', u'$487'),
... (u'31/05/2013', u'11:13', u'$487'),
... (u'31/05/2013', u'11:19', u'$487'),
... ]
>>> for row in rows:
... print u' {:<15} {:<8} {:<6}'.format(*row)
...
31/05/2013 11:10 $487
31/05/2013 11:11 $487
31/05/2013 11:13 $487
31/05/2013 11:19 $487
1
solved how to delete the “u and ‘ ‘ ” before the of database table display by python [closed]