diff options
author | Jovina | 2011-05-09 10:32:06 +0530 |
---|---|---|
committer | Jovina | 2011-05-09 10:32:06 +0530 |
commit | 45d79639e61ca369c45b77a7b3751e5ddf05bbb2 (patch) | |
tree | 59b98c4fcc89c898a825e9f6f83a82e79ea13c26 /getting_started_with_files/script.rst | |
parent | 96ef551c38234ab234e47b78936f184b9e4e42e3 (diff) | |
parent | 1020097fa446ad8c6bdff784d5d0da9e98a55892 (diff) | |
download | st-scripts-45d79639e61ca369c45b77a7b3751e5ddf05bbb2.tar.gz st-scripts-45d79639e61ca369c45b77a7b3751e5ddf05bbb2.tar.bz2 st-scripts-45d79639e61ca369c45b77a7b3751e5ddf05bbb2.zip |
Modified Embellishing plots,loading data from files,plotting data.
Merge branch 'master' of https://github.com/FOSSEE/st-scripts
Conflicts:
Diffstat (limited to 'getting_started_with_files/script.rst')
-rw-r--r-- | getting_started_with_files/script.rst | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/getting_started_with_files/script.rst b/getting_started_with_files/script.rst index bd3dc9b..259be80 100644 --- a/getting_started_with_files/script.rst +++ b/getting_started_with_files/script.rst @@ -1,11 +1,11 @@ .. Objectives .. ---------- -.. By the end of this tutorial, you will be able to -.. 1. Open and read the contents of a file. -.. #. Read files line by line. -.. #. Read all the contents of the file at once. -.. #. Close open files. +.. At the end of this spoken tutorial, you will be able to: +.. 1. Open a file. +.. #. Read the content of the file line by line. +.. #. Read entire contents of the file at once. +.. #. Close the file. .. Prerequisites .. ------------- @@ -58,8 +58,7 @@ 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 -the ``read`` method of ``f`` to read, all the contents of the file +variable. We use the ``read`` method of ``f`` to read, all the contents of the file into the variable ``pend``. :: @@ -134,7 +133,7 @@ the file line-wise and print each of the lines. for line in f: print line -As we already know, ``line`` is variable, sometimes called the loop +``line`` is variable, sometimes called the loop variable, and it is not a keyword. We could have used any other variable name, but ``line`` seems meaningful enough. |