summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-10-07 15:11:38 +0530
committerPuneeth Chaganti2010-10-07 15:11:38 +0530
commit230602dbda56ca285e93154997c5e9d853f4a2a7 (patch)
tree8c11ceb1786a1f0e64553ff3962e5cbb8fd5c1b7
parentf9076e63c37c10a7618fe2b08b2a1f7d4cef9a5e (diff)
downloadst-scripts-230602dbda56ca285e93154997c5e9d853f4a2a7.tar.gz
st-scripts-230602dbda56ca285e93154997c5e9d853f4a2a7.tar.bz2
st-scripts-230602dbda56ca285e93154997c5e9d853f4a2a7.zip
Added questions to getting started with files LO.
-rw-r--r--getting-started-files/script.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/getting-started-files/script.rst b/getting-started-files/script.rst
index df47fa2..5c21dcc 100644
--- a/getting-started-files/script.rst
+++ b/getting-started-files/script.rst
@@ -53,7 +53,8 @@ see what it is.
f
The file object shows, the file which is open and the mode (read
-or write) in which it is open.
+or write) in which it is open. Notice that it is open in read only
+mode, here.
We shall first learn to read the whole file into a single
variable. Later, we shall look at reading it line-by-line. We use
@@ -74,7 +75,7 @@ to see more explicitly, what it contains.
pend
-Following is an (are) exercise(s) that you must do.
+Following is an exercise that you must do.
%%1%% Split the variable into a list, ``pend_list``, of the lines in
the file. Hint, use the tab command to see what methods the string
@@ -151,8 +152,10 @@ file object ``f`` and directly open the file within the for
statement. This will save us the trouble of closing the file, each
time we open it.
-for line in open('/home/fossee/pendulum.txt'):
-line_list.append(line)
+::
+
+ for line in open('/home/fossee/pendulum.txt'):
+ line_list.append(line)
Let us see what ``line_list`` contains.
::