using python modules/script.rst
changeset 440 b2e8522839f0
parent 371 d87828051c69
child 482 b554ce5a7b26
equal deleted inserted replaced
439:b437ff7def95 440:b2e8522839f0
    26 ====================
    26 ====================
    27 Using Python modules
    27 Using Python modules
    28 ====================
    28 ====================
    29 {{{ show the welcome slide }}}
    29 {{{ show the welcome slide }}}
    30 
    30 
    31 Welcome to the spoken tutorial on using python modules.
    31 Welcome to the spoken tutorial on Using Python Modules.
    32 
    32 
    33 {{{ switch to next slide, outline slide }}}
    33 {{{ switch to next slide, outline slide }}}
    34 
    34 
    35 In this tutorial, we will see how to run python scripts from command
    35 In this tutorial, we will see how to run python scripts from command
    36 line. See importing modules, importing scipy and pylab modules. And
    36 line. We'll see how to import modules, importing scipy and pylab
    37 also see the Python standard library.
    37 modules and have a look at the Python standard library.
    38 
       
    39 .. #[Punch: the sentence seems discontinuous.]
       
    40 
    38 
    41 {{{ switch to next slide on executing python scripts from command line }}}
    39 {{{ switch to next slide on executing python scripts from command line }}}
    42 
    40 
    43 Let us create a simple python script to print hello world. Open your
    41 Let us create a simple python script to print hello world. Open your
    44 text editor and type the following,
    42 text editor and type the following,
    47 ::
    45 ::
    48 
    46 
    49     print "Hello world!"
    47     print "Hello world!"
    50     print
    48     print
    51 
    49 
    52 and save the script as hello.py,
    50 and save the script as ``hello.py``,
    53 
    51 
    54 {{{ save the script as hello.py }}}
    52 {{{ save the script as hello.py }}}
    55 
    53 
    56 Till now we saw how to run a script using the IPython interpreter
    54 Till now we saw how to run a script using the IPython interpreter
    57 using the
    55 using the
   185 previous method, and the functions are called as ``pylab.plot()`` and
   183 previous method, and the functions are called as ``pylab.plot()`` and
   186 ``pylab.annotate()`` and not as ``plot()`` and ``annotate()``.
   184 ``pylab.annotate()`` and not as ``plot()`` and ``annotate()``.
   187 
   185 
   188 {{{ switch to next slide, problem statement }}}
   186 {{{ switch to next slide, problem statement }}}
   189 
   187 
   190 Write a script to plot a sine wave from minus two pi to two pi.
   188 %% %% Write a script to plot a sine wave from minus two pi to two pi.
   191 
   189 
   192 Pause here and try to solve the problem yourself before looking at the
   190 Pause here and try to solve the problem yourself before looking at the
   193 solution.
   191 solution.
   194 
   192 
   195 It can solved as,
   193 It can solved as,
   232 And there are lot more.
   230 And there are lot more.
   233 
   231 
   234 Find more information at Python Library reference,
   232 Find more information at Python Library reference,
   235 ``http://docs.python.org/library/``
   233 ``http://docs.python.org/library/``
   236 
   234 
   237 The modules pylab, scipy, Mayavi are not part of the standard python
   235 There are a lot of other modules like pylab, scipy, Mayavi, etc which
   238 library.
   236 are not part of the standard python library.
   239 
   237 
   240 {{{ switch to next slide, summary }}}
   238 {{{ switch to next slide, summary }}}
   241 
   239 
   242 This brings us to the end of this tutorial, in this tutorial we
   240 This brings us to the end of this tutorial, in this tutorial we
   243 learned running scripts from command line, learned about modules, saw
   241 learned running scripts from command line, learned about modules, saw