hello,
i'm trying to read the content of file into the variable at once. It has been successful. But how can i split each new line into array.
Let us assume the file contains the following line
192.114.82.90 - - [01/Nov/1998:00:32:54 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 404 -
192.114.82.90 - - [01/Nov/1998:00:33:03 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 300 1234
192.114.82.90 - - [01/Nov/1998:00:33:03 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 300 -
Thanks in advance....
i'm trying to read the content of file into the variable at once. It has been successful. But how can i split each new line into array.
Let us assume the file contains the following line
192.114.82.90 - - [01/Nov/1998:00:32:54 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 404 -
192.114.82.90 - - [01/Nov/1998:00:33:03 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 300 1234
192.114.82.90 - - [01/Nov/1998:00:33:03 +0200] www.actcom.co.il "GET /~choo/lupg/images/good_bar.gif HTTP/1.0" 300 -
Code:
def file_get_contents(filename): with open(filename) as a_file: return a_file.read() content = file_get_contents(filename)
Comment