change line with columns when print

Almar Klein almar.klein at gmail.com
Wed Oct 1 07:57:00 EDT 2008


Hi,

probably not the best solution, but this should work:

L1 = []
L2 = []
for i in file:
    tmp = i.split(" ")
    L1.append(tmp[0])
    L2.append(tmp[1])

for i in L1:
    print i,
print # new line
for i in L2:
    print i,
print # new line

Almar


2008/10/1 sandric ionut <sandricionut at yahoo.com>

>
> Hello:
> I have a text file that looks like:
> 0 23
> 1 342
> 3 31
> and I want to read the file and print it out like:
> 0 1 3
> 23 342 31
>
> How can I do this?
>
> Thnak you in advance,
>
> Ionut
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081001/bb5b7b80/attachment-0001.html>


More information about the Python-list mailing list