summaryrefslogtreecommitdiff
path: root/getting-started-files/quickref.tex
diff options
context:
space:
mode:
Diffstat (limited to 'getting-started-files/quickref.tex')
-rw-r--r--getting-started-files/quickref.tex16
1 files changed, 10 insertions, 6 deletions
diff --git a/getting-started-files/quickref.tex b/getting-started-files/quickref.tex
index b26d168..17b4d33 100644
--- a/getting-started-files/quickref.tex
+++ b/getting-started-files/quickref.tex
@@ -1,8 +1,12 @@
-Creating a linear array:\\
-{\ex \lstinline| x = linspace(0, 2*pi, 50)|}
+\textbf{Getting Started -- files}
-Plotting two variables:\\
-{\ex \lstinline| plot(x, sin(x))|}
+\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.
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline| plot(x, y)|}