Presentation is loading. Please wait.

Presentation is loading. Please wait.

Title Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center 31-Oct-2006 A Python Tutorial Kurt Schwehr 31 Oct 2006.

Similar presentations


Presentation on theme: "Title Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center 31-Oct-2006 A Python Tutorial Kurt Schwehr 31 Oct 2006."— Presentation transcript:

1 Title Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center 31-Oct-2006 A Python Tutorial Kurt Schwehr 31 Oct 2006

2 http://docs.python.org/tut/

3 Where is python on my machine?

4 Fink for unix software

5 Fink Commander

6 Emacs Cheat Sheet

7 Setting up ~/.emacs

8

9 Getting started

10 Strings

11 Getting help with the ‘tab’ key

12 More string operations

13 Lists are created with [ ]

14 The math module

15 Getting help on functions

16 More help

17 from math import *

18 The Decimal module

19 Converting between strings and numbers

20 If tests and indentation matters

21 for loops

22 Reading a file Adding a comma prevents the extra new line

23 Reading numbers from a file

24 A quick intro to time

25 Getting to the web documentation

26

27 Writing data to a file

28 Old school - gnuplot

29 Gnuplot in 3D

30 Saving gnuplot to gif or pdf

31 Writing a python file (aka module) env finds python in your path chmod +x dump.py./dump.py

32 Handling programs in a better way __name__ is set to main if the file is being executed

33 Making our code a proper function

34 Function parameters can be specified by name

35 Use this function from outside the file Whoops - no documentation!

36 Often it is good to give a parameter a default

37 Add some ‘doc strings’

38 Documentation as seen from ipython

39 Epydoc is Kurt’s favorite way to document python code Epydoc imports your file and creates html documentation

40 Here is the initial edydoc page Nice, but could be better Use markups in the doc string to tell epydoc more

41 Adding more to the file

42 Document the function


Download ppt "Title Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center 31-Oct-2006 A Python Tutorial Kurt Schwehr 31 Oct 2006."

Similar presentations


Ads by Google