Skip to content

Reading Files

Ariel Balter edited this page Mar 30, 2016 · 3 revisions

http://stackoverflow.com/questions/3277503/python-read-file-line-by-line-into-array

array = [] #declaring a list with name '**array**' 
with open(PATH,'r') as reader :
    for line in reader :
        array.append(line)

http://stackoverflow.com/questions/8009882/how-to-read-large-file-line-by-line-in-python

with open(...) as f:
    for line in f:
        <do something with line>
Clone this wiki locally