
November 8th, 2003, 02:34 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
For small lists of data this wouldn't be much of a problem but with HUGE lists this could be slow; because strings in Python are imutable the Python interpreter has to make copies of the strings when consinating them (string + string) and etc.
This should work better:
Code:
#!/usr/bin/env python
l = [[1,2,3],[4,5,6],[7,8,9]]
j = []
for s in l:
for e in s:
j.append(str(e))
print ''.join(j)
it only joins the data and doesnt display it in a matrix style like yogis does but you can do this is say.. one more line by appending a '\n' in there.
Mark.
__________________
programming language development: www.netytan.com – Hula
|