I have looked into the pprint function, which i tried below:
from pprint import pprint
a = [[1,开发者_开发技巧2],[3,4]]
pprint(a)
But it didn't give me what i want, which is:
1 2
3 4
Is there a simple way to solve this ?
That's... not what pprint
does.
for i in a:
print ' '.join(i)
You can either do what Ignacio said or change the width of pprint:
>>> pprint.pprint([[1,2],[3,4]], width=10)
[[1, 2],
[3, 4]]
But you would have to calculate the space that your list takes...
精彩评论