diff -r 88a01948450d -r d33698326409 getting_started_with_files/quickref.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getting_started_with_files/quickref.tex Wed Dec 01 16:51:35 2010 +0530 @@ -0,0 +1,12 @@ +\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. +