change line with columns when print

sandric ionut sandricionut at yahoo.com
Wed Oct 1 08:07:14 EDT 2008


Thank you Almar

It worked :), I now have to format it nicely

Ionut



----- Original Message ----
From: Almar Klein <almar.klein at gmail.com>
To: python-list at python.org
Sent: Wednesday, October 1, 2008 2:57:00 PM
Subject: Re: change line with columns when print


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/d402f9b7/attachment-0001.html>


More information about the Python-list mailing list