getting-started-files/quickref.tex
changeset 522 d33698326409
parent 521 88a01948450d
child 523 54bdda4aefa5
equal deleted inserted replaced
521:88a01948450d 522:d33698326409
     1 \textbf{Getting Started -- files}
       
     2 
       
     3 \lstinline|f = open('filename')| returns a file object. \lstinline|f|
       
     4 can be used to perform further operations on the file. 
       
     5 
       
     6 \lstinline|f.read()| reads the whole file and returns the contents. 
       
     7 
       
     8 \lstinline|f.close()| closes the file. 
       
     9 
       
    10 \lstinline|for line in open('filename'):| -- iterate over the file
       
    11 line-by-line. 
       
    12