getting-started-files/quickref.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Wed, 10 Nov 2010 17:39:42 +0530
changeset 444 1aa91f8d8d59
parent 285 7c4855fb8e5f
permissions -rw-r--r--
added script getting started with functions.

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