summaryrefslogtreecommitdiff
path: root/getting-started-files
diff options
context:
space:
mode:
Diffstat (limited to 'getting-started-files')
-rw-r--r--getting-started-files/pendulum.txt90
-rw-r--r--getting-started-files/quickref.tex12
-rw-r--r--getting-started-files/script.rst189
-rw-r--r--getting-started-files/slides.org73
-rw-r--r--getting-started-files/slides.tex115
5 files changed, 0 insertions, 479 deletions
diff --git a/getting-started-files/pendulum.txt b/getting-started-files/pendulum.txt
deleted file mode 100644
index 7e07566..0000000
--- a/getting-started-files/pendulum.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-1.0000e-01 6.9004e-01
-1.1000e-01 6.9497e-01
-1.2000e-01 7.4252e-01
-1.3000e-01 7.5360e-01
-1.4000e-01 8.3568e-01
-1.5000e-01 8.6789e-01
-1.6000e-01 8.4182e-01
-1.7000e-01 8.5379e-01
-1.8000e-01 8.5762e-01
-1.9000e-01 8.8390e-01
-2.0000e-01 8.9985e-01
-2.1000e-01 9.8436e-01
-2.2000e-01 1.0244e+00
-2.3000e-01 1.0572e+00
-2.4000e-01 9.9077e-01
-2.5000e-01 1.0058e+00
-2.6000e-01 1.0727e+00
-2.7000e-01 1.0943e+00
-2.8000e-01 1.1432e+00
-2.9000e-01 1.1045e+00
-3.0000e-01 1.1867e+00
-3.1000e-01 1.1385e+00
-3.2000e-01 1.2245e+00
-3.3000e-01 1.2406e+00
-3.4000e-01 1.2071e+00
-3.5000e-01 1.2658e+00
-3.6000e-01 1.2995e+00
-3.7000e-01 1.3142e+00
-3.8000e-01 1.2663e+00
-3.9000e-01 1.2578e+00
-4.0000e-01 1.2991e+00
-4.1000e-01 1.3058e+00
-4.2000e-01 1.3478e+00
-4.3000e-01 1.3506e+00
-4.4000e-01 1.4044e+00
-4.5000e-01 1.3948e+00
-4.6000e-01 1.3800e+00
-4.7000e-01 1.4480e+00
-4.8000e-01 1.4168e+00
-4.9000e-01 1.4719e+00
-5.0000e-01 1.4656e+00
-5.1000e-01 1.4399e+00
-5.2000e-01 1.5174e+00
-5.3000e-01 1.4988e+00
-5.4000e-01 1.4751e+00
-5.5000e-01 1.5326e+00
-5.6000e-01 1.5297e+00
-5.7000e-01 1.5372e+00
-5.8000e-01 1.6094e+00
-5.9000e-01 1.6352e+00
-6.0000e-01 1.5843e+00
-6.1000e-01 1.6643e+00
-6.2000e-01 1.5987e+00
-6.3000e-01 1.6585e+00
-6.4000e-01 1.6317e+00
-6.5000e-01 1.7074e+00
-6.6000e-01 1.6654e+00
-6.7000e-01 1.6551e+00
-6.8000e-01 1.6964e+00
-6.9000e-01 1.7143e+00
-7.0000e-01 1.7706e+00
-7.1000e-01 1.7622e+00
-7.2000e-01 1.7260e+00
-7.3000e-01 1.8089e+00
-7.4000e-01 1.7905e+00
-7.5000e-01 1.7428e+00
-7.6000e-01 1.8381e+00
-7.7000e-01 1.8182e+00
-7.8000e-01 1.7865e+00
-7.9000e-01 1.7995e+00
-8.0000e-01 1.8296e+00
-8.1000e-01 1.8625e+00
-8.2000e-01 1.8623e+00
-8.3000e-01 1.8383e+00
-8.4000e-01 1.8593e+00
-8.5000e-01 1.8944e+00
-8.6000e-01 1.9598e+00
-8.7000e-01 1.9000e+00
-8.8000e-01 1.9244e+00
-8.9000e-01 1.9397e+00
-9.0000e-01 1.9440e+00
-9.1000e-01 1.9718e+00
-9.2000e-01 1.9383e+00
-9.3000e-01 1.9555e+00
-9.4000e-01 2.0006e+00
-9.5000e-01 1.9841e+00
-9.6000e-01 2.0066e+00
-9.7000e-01 2.0493e+00
-9.8000e-01 2.0503e+00
-9.9000e-01 2.0214e+00
diff --git a/getting-started-files/quickref.tex b/getting-started-files/quickref.tex
deleted file mode 100644
index 17b4d33..0000000
--- a/getting-started-files/quickref.tex
+++ /dev/null
@@ -1,12 +0,0 @@
-\textbf{Getting Started -- files}
-
-\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.
-
diff --git a/getting-started-files/script.rst b/getting-started-files/script.rst
deleted file mode 100644
index bd3dc9b..0000000
--- a/getting-started-files/script.rst
+++ /dev/null
@@ -1,189 +0,0 @@
-.. 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.
-
-.. Prerequisites
-.. -------------
-
-.. 1. getting started with ipython
-.. #. getting started with lists
-.. #. getting started with for
-
-.. Author : Puneeth
- Internal Reviewer : Anoop Jacob Thomas<anoop@fossee.in>
- External Reviewer :
- Language Reviewer : Bhanukiran
- Checklist OK? : <06-11-2010, Anand, OK> [2010-10-05]
-
-Script
-------
-
-{{{ Show the slide containing title }}}
-
-Hello Friends. Welcome to the tutorial on getting started with files.
-
-{{{ Show the outline for this tutorial }}}
-
-In this tutorial we shall learn to read files, and do some basic
-actions on the file, like opening and reading a file, closing a
-file, iterating through the file line-by-line, and appending the
-lines of a file to a list.
-
-{{{ switch back to the terminal }}}
-
-As usual, we start IPython, using
-::
-
- ipython -pylab
-
-Let us first open the file, ``pendulum.txt`` present in
-``/home/fossee/``.
-::
-
- f = open('/home/fossee/pendulum.txt')
-
-``f`` is called a file object. Let us type ``f`` on the terminal to
-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. 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
-into the variable ``pend``.
-::
-
- pend = f.read()
-
-Now, let us see what is in ``pend``, by typing
-::
-
- print pend
-
-We can see that ``pend`` has all the data of the file. Type just ``pend``
-to see more explicitly, what it contains.
-::
-
- pend
-
-Following is an exercise that you must do.
-
-{{ show slide with Question 1 }}
-
-%%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.
-
-Please, pause the video here. Do the exercise and then continue.
-
-{{ show slide with Solution 1 }}
-
-::
-
- pend_list = pend.splitlines()
-
- pend_list
-
-Now, let us learn to read the file line-by-line. But, before that we
-will have to close the file, since the file has already been read till
-the end.
-
-Let us close the file opened into f.
-::
-
- f.close()
-
-Let us again type ``f`` on the prompt to see what it shows.
-::
-
- f
-
-Notice, that it now says the file has been closed. It is a good
-programming practice to close any file objects that we have
-opened, after their job is done.
-
-Let us, now move on to reading files line-by-line.
-
-Following is an exercise that you must do.
-
-%%2%% Re-open the file ``pendulum.txt`` with ``f`` as the file object.
-
-Please, pause the video here. Do the exercise and then continue.
-
-We just use the up arrow until we reach the open command and issue
-it again.
-::
-
- f = open('/home/fossee/pendulum.txt')
-
-Now, to read the file line-by-line, we iterate over the file
-object line-by-line, using the ``for`` command. Let us iterate over
-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
-variable, and it is not a keyword. We could have used any other
-variable name, but ``line`` seems meaningful enough.
-
-Instead of just printing the lines, let us append them to a list,
-``line_list``. We first initialize an empty list, ``line_list``.
-::
-
- line_list = [ ]
-
-Let us then read the file line-by-line and then append each of the
-lines, to the list. We could, as usual close the file using
-``f.close`` and re-open it. But, this time, let's leave alone the
-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)
-
-Let us see what ``line_list`` contains.
-::
-
- line_list
-
-Notice that ``line_list`` is a list of the lines in the file, along
-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.
-
-Using some string methods, that we shall look at in the tutorial on
-strings, we can strip out the newline characters from the lines.
-
-.. #[[Anoop: I think the code that are required to be typed can be
- added to the slide.]]
-
-{{{ show the summary slide }}}
-
-That brings us to the end of this tutorial. In this tutorial we
-have learnt to open and close files, read the data in the files as
-a whole, using the read command or reading it line by line by
-iterating over the file object.
-
-{{{ Show the "sponsored by FOSSEE" slide }}}
-
-This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
-
-Hope you have enjoyed and found it useful.
-Thank you!
-
-
diff --git a/getting-started-files/slides.org b/getting-started-files/slides.org
deleted file mode 100644
index d9e6428..0000000
--- a/getting-started-files/slides.org
+++ /dev/null
@@ -1,73 +0,0 @@
-#+LaTeX_CLASS: beamer
-#+LaTeX_CLASS_OPTIONS: [presentation]
-#+BEAMER_FRAME_LEVEL: 1
-
-#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
-#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
-#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
-
-#+LaTeX_CLASS: beamer
-#+LaTeX_CLASS_OPTIONS: [presentation]
-
-#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
-#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
-
-#+LaTeX_HEADER: \usepackage{listings}
-
-#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
-#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
-#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
-
-#+TITLE: Getting started with files
-#+AUTHOR: FOSSEE
-#+EMAIL:
-#+DATE:
-
-#+DESCRIPTION:
-#+KEYWORDS:
-#+LANGUAGE: en
-#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
-#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
-
-* Outline
- - Opening and reading contents of a file
- - Closing open files
- - Reading all the contents of the file at once
- - Reading files line by line
-* Question 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.
-* Solution 1
- #+begin_src python
- In []: pend_list = pend.splitlines()
-
- In []: pend_list
- #+end_src
-* Question 2
- Re-open the file =pendulum.txt= with =f= as the file object.
-* Solution 2
- #+begin_src python
- In []: f = open('/home/fossee/pendulum.txt')
- #+end_src
-* Summary
- - Opening a file using =open= function
- - Reading all the contents of the file at once using =read()= method
- - Closing open files using the =close= method
- - Reading files line by line by iterating using a =for= loop
-* Thank you!
-#+begin_latex
- \begin{block}{}
- \begin{center}
- This spoken tutorial has been produced by the
- \textcolor{blue}{FOSSEE} team, which is funded by the
- \end{center}
- \begin{center}
- \textcolor{blue}{National Mission on Education through \\
- Information \& Communication Technology \\
- MHRD, Govt. of India}.
- \end{center}
- \end{block}
-#+end_latex
-
-
diff --git a/getting-started-files/slides.tex b/getting-started-files/slides.tex
deleted file mode 100644
index f3e1765..0000000
--- a/getting-started-files/slides.tex
+++ /dev/null
@@ -1,115 +0,0 @@
-% Created 2010-10-21 Thu 14:35
-\documentclass[presentation]{beamer}
-\usepackage[latin1]{inputenc}
-\usepackage[T1]{fontenc}
-\usepackage{fixltx2e}
-\usepackage{graphicx}
-\usepackage{longtable}
-\usepackage{float}
-\usepackage{wrapfig}
-\usepackage{soul}
-\usepackage{t1enc}
-\usepackage{textcomp}
-\usepackage{marvosym}
-\usepackage{wasysym}
-\usepackage{latexsym}
-\usepackage{amssymb}
-\usepackage{hyperref}
-\tolerance=1000
-\usepackage[english]{babel} \usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
-\usepackage{listings}
-\lstset{language=Python, basicstyle=\ttfamily\bfseries,
-commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
-showstringspaces=false, keywordstyle=\color{blue}\bfseries}
-\providecommand{\alert}[1]{\textbf{#1}}
-
-\title{Getting started with files}
-\author{FOSSEE}
-\date{}
-
-\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
-\begin{document}
-
-\maketitle
-
-
-
-
-
-
-
-
-
-\begin{frame}
-\frametitle{Outline}
-\label{sec-1}
-
-\begin{itemize}
-\item Opening and reading contents of a file
-\item Closing open files
-\item Reading all the contents of the file at once
-\item Reading files line by line
-\end{itemize}
-\end{frame}
-\begin{frame}
-\frametitle{Question 1}
-\label{sec-2}
-
- Split the variable into a list, \texttt{pend\_list}, of the lines in the
- file. Hint, use the tab command to see what methods the string
- variable has.
-\end{frame}
-\begin{frame}[fragile]
-\frametitle{Solution 1}
-\label{sec-3}
-
-\begin{verbatim}
-In []: pend_list = pend.splitlines()
-
-In []: pend_list
-\end{verbatim}
-\end{frame}
-\begin{frame}
-\frametitle{Question 2}
-\label{sec-4}
-
- Re-open the file \texttt{pendulum.txt} with \texttt{f} as the file object.
-\end{frame}
-\begin{frame}[fragile]
-\frametitle{Solution 2}
-\label{sec-5}
-
-\begin{verbatim}
-In []: f = open('/home/fossee/pendulum.txt')
-\end{verbatim}
-\end{frame}
-\begin{frame}
-\frametitle{Summary}
-\label{sec-6}
-
-\begin{itemize}
-\item Opening a file using \texttt{open} function
-\item Reading all the contents of the file at once using \texttt{read()} method
-\item Closing open files using the \texttt{close} method
-\item Reading files line by line by iterating using a \texttt{for} loop
-\end{itemize}
-\end{frame}
-\begin{frame}
-\frametitle{Thank you!}
-\label{sec-7}
-
- \begin{block}{}
- \begin{center}
- This spoken tutorial has been produced by the
- \textcolor{blue}{FOSSEE} team, which is funded by the
- \end{center}
- \begin{center}
- \textcolor{blue}{National Mission on Education through \\
- Information \& Communication Technology \\
- MHRD, Govt. of India}.
- \end{center}
- \end{block}
-\end{frame}
-
-\end{document}