getting-started-files/quickref.tex
author Nishanth <nishanth@fossee.in>
Tue, 12 Oct 2010 10:32:34 +0530
changeset 328 9ab73cbdd5a8
parent 285 7c4855fb8e5f
permissions -rw-r--r--
embellishing_a_plot is complete

\textbf{Getting Started -- files}

\lstinline|f = open('filename')| returns a file object. \lstinline|f|
can be used to perform further operations on the file. 

\lstinline|f.read()| reads the whole file and returns the contents. 

\lstinline|f.close()| closes the file. 

\lstinline|for line in open('filename'):| -- iterate over the file
line-by-line.