read input file a line as a list in python

Golawala, Moiz M (GE Infrastructure) Moiz.Golawala at
Tue Aug 17 20:47:10 CEST 2004

You could do this:

fileList = []
file = open("fileName.txt","r")

#read one line at a time into a list

Moiz Golawala
GE Infrastructure, Security
Software Engineer
Enterprise Solutions

T 561 994 5972
F 561 994 6572
E moiz.golawala at

791 Park of Commerce Blvd., Suite 100
Boca Raton, FL, 33487, U.S.A.
GE Security, Inc.

-----Original Message-----
From: at
[ at]On Behalf Of
Yong Wang
Sent: Tuesday, August 17, 2004 2:41 PM
To: python-list at
Subject: read input file a line as a list in python

Hi, All:
    I need to read a input file as soucre to process data. Ideally
if I can read a line from input file as a list (coloumn separate by
white space), reorganize field in a line. Does python has this kind of 
command ? 
   for example, I read a line has:
   "IP  MAC Date..." as a line from input file, How  can I only get MAC ?


More information about the Python-list mailing list