summaryrefslogtreecommitdiff
path: root/getting_started_with_files/quickref.tex
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-12-01 16:51:35 +0530
committerPuneeth Chaganti2010-12-01 16:51:35 +0530
commitf3a34dfb4e879f3eb7274704f44546aac4add88f (patch)
tree1cb0a8cc5dbd5ee2b374350915ed2addfa0fb447 /getting_started_with_files/quickref.tex
parent347866ed0d29db61ee062563b1e1616cfb85588c (diff)
downloadst-scripts-f3a34dfb4e879f3eb7274704f44546aac4add88f.tar.gz
st-scripts-f3a34dfb4e879f3eb7274704f44546aac4add88f.tar.bz2
st-scripts-f3a34dfb4e879f3eb7274704f44546aac4add88f.zip
Renamed all LOs to match with their names in progress.org.
Diffstat (limited to 'getting_started_with_files/quickref.tex')
-rw-r--r--getting_started_with_files/quickref.tex12
1 files changed, 12 insertions, 0 deletions
diff --git a/getting_started_with_files/quickref.tex b/getting_started_with_files/quickref.tex
new file mode 100644
index 0000000..17b4d33
--- /dev/null
+++ b/getting_started_with_files/quickref.tex
@@ -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.
+