# HG changeset patch # User Anoop Jacob Thomas # Date 1287665248 -19800 # Node ID d82151cc11f5f7b07cc5877e606c5cb4b9006793 # Parent 700785318ed27bba75428dc79a27c50c34485856 Reviewed script getting started with files. diff -r 700785318ed2 -r d82151cc11f5 getting-started-files/questions.rst --- a/getting-started-files/questions.rst Thu Oct 21 14:34:15 2010 +0530 +++ b/getting-started-files/questions.rst Thu Oct 21 18:17:28 2010 +0530 @@ -77,6 +77,8 @@ .. Should this be made a multiple-choice? + .. #[[Anoop: I think it will better if we make this multiple + choice]] #. Given a file with ``hello.txt``, which looks like :: diff -r 700785318ed2 -r d82151cc11f5 getting-started-files/script.rst --- a/getting-started-files/script.rst Thu Oct 21 14:34:15 2010 +0530 +++ b/getting-started-files/script.rst Thu Oct 21 18:17:28 2010 +0530 @@ -15,7 +15,7 @@ .. #. getting started with for .. Author : Puneeth - Internal Reviewer : + Internal Reviewer : Anoop Jacob Thomas External Reviewer : Checklist OK? : [2010-10-05] @@ -77,6 +77,8 @@ 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 @@ .. 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 @@ .. #[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 @@ 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 @@ 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 -r 700785318ed2 -r d82151cc11f5 getting-started-files/slides.tex --- a/getting-started-files/slides.tex Thu Oct 21 14:34:15 2010 +0530 +++ b/getting-started-files/slides.tex Thu Oct 21 18:17:28 2010 +0530 @@ -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 @@ - \begin{frame} \frametitle{Outline} \label{sec-1} @@ -64,12 +64,11 @@ \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 @@ \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} diff -r 700785318ed2 -r d82151cc11f5 progress.org --- a/progress.org Thu Oct 21 14:34:15 2010 +0530 +++ b/progress.org Thu Oct 21 18:17:28 2010 +0530 @@ -16,7 +16,7 @@ | 3.1 LO: | getting started with lists | 2 | Amit | | | | 3.2 LO: | getting started with =for= | 2 | Anoop | Nishanth (Done) | | | 3.3 LO: | getting started with strings | 2 | Madhu | | | -| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Pending) | | +| 3.4 LO: | getting started with files | 3 | Punch | Anoop(Done) | | | 3.5 LO: | parsing data | 3 | Nishanth | Amit (Done) | | | 3.6 LO: | statistics | 2 | Amit | | | | 3.7 LO: | module level assessment | 3 | Madhu | | |