diff options
author | Anoop Jacob Thomas | 2010-10-21 18:17:28 +0530 |
---|---|---|
committer | Anoop Jacob Thomas | 2010-10-21 18:17:28 +0530 |
commit | 171b9f276eaba9a04b7b6bbb60ce19a082bd91e3 (patch) | |
tree | 9f424849155dd616199ae2f9dba3bc61bad7064e /getting-started-files | |
parent | e459d929447f2b33492fad2106be2b9f6f516edd (diff) | |
download | st-scripts-171b9f276eaba9a04b7b6bbb60ce19a082bd91e3.tar.gz st-scripts-171b9f276eaba9a04b7b6bbb60ce19a082bd91e3.tar.bz2 st-scripts-171b9f276eaba9a04b7b6bbb60ce19a082bd91e3.zip |
Reviewed script getting started with files.
Diffstat (limited to 'getting-started-files')
-rw-r--r-- | getting-started-files/script.rst | 25 | ||||
-rw-r--r-- | getting-started-files/slides.tex | 14 |
2 files changed, 30 insertions, 9 deletions
diff --git a/getting-started-files/script.rst b/getting-started-files/script.rst index 5c21dcc..1a77eb8 100644 --- a/getting-started-files/script.rst +++ b/getting-started-files/script.rst @@ -15,7 +15,7 @@ .. #. getting started with for .. Author : Puneeth - Internal Reviewer : + Internal Reviewer : Anoop Jacob Thomas<anoop@fossee.in> External Reviewer : Checklist OK? : <put date stamp here, if OK> [2010-10-05] @@ -77,6 +77,8 @@ to see more explicitly, what it contains. Following is an exercise that you must do. +.. #[[Anoop:add context switch to next slide - questions]] + %%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 variable has. @@ -87,6 +89,11 @@ Please, pause the video here. Do the exercise and then continue. .. where we mention that strings have methods for manipulation. hint: .. use splitlines()] +.. #[[Anoop: let us have it here, let us consider this as a + refresher]] + +.. #[[Anoop:add context switch to next slide - solution]] + :: pend_list = pend.splitlines() @@ -99,6 +106,10 @@ the end. .. #[punch: should we mention file-pointer?] +.. #[[Anoop: I think we can say that ``f`` is a file pointer which + points to the next line/data to be read from the file. We could + skip details.]] + Let us close the file opened into f. :: @@ -139,6 +150,9 @@ As we already know, ``line`` is just a dummy variable, and not a keyword. We could have used any other variable name, but ``line`` seems meaningful enough. +.. #[[Anoop: using dummy variable doesn't seem correct, can say line + is a variable]] + Instead of just printing the lines, let us append them to a list, ``line_list``. We first initialize an empty list, ``line_list``. :: @@ -167,6 +181,15 @@ with the newline characters. If you noticed, ``pend_list`` did not contain the newline characters, because the string ``pend`` was split on the newline characters. +.. #[[Anoop: I think we need to tell them that each line can be + stripped and appended to list to avoid the problem of newline + characters.]] + +.. #[[Anoop: I think the code that are required to be typed can be + added to the slide.]] + +.. #[[Anoop: Context switches are to be added.]] + {{{ show the summary slide }}} That brings us to the end of this tutorial. In this tutorial we diff --git a/getting-started-files/slides.tex b/getting-started-files/slides.tex index f82d946..f3e1765 100644 --- a/getting-started-files/slides.tex +++ b/getting-started-files/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-10-10 Sun 17:51 +% Created 2010-10-21 Thu 14:35 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -8,6 +8,7 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} +\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -40,7 +41,6 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} - \begin{frame} \frametitle{Outline} \label{sec-1} @@ -64,12 +64,11 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \frametitle{Solution 1} \label{sec-3} -\lstset{language=Python} -\begin{lstlisting} +\begin{verbatim} In []: pend_list = pend.splitlines() In []: pend_list -\end{lstlisting} +\end{verbatim} \end{frame} \begin{frame} \frametitle{Question 2} @@ -81,10 +80,9 @@ In []: pend_list \frametitle{Solution 2} \label{sec-5} -\lstset{language=Python} -\begin{lstlisting} +\begin{verbatim} In []: f = open('/home/fossee/pendulum.txt') -\end{lstlisting} +\end{verbatim} \end{frame} \begin{frame} \frametitle{Summary} |