getting-started-files/quickref.tex
author Amit Sethi
Tue, 09 Nov 2010 01:28:00 +0530
changeset 406 a534e9e79599
parent 285 7c4855fb8e5f
permissions -rw-r--r--
Completed basic data type based on review and improved on slides

\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.