author | Puneeth Chaganti <punchagan@fossee.in> |
Tue, 09 Nov 2010 15:33:47 +0530 | |
changeset 413 | da1f270b07b7 |
parent 285 | 7c4855fb8e5f |
permissions | -rw-r--r-- |
\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.