1 / 45

Title

31-Oct-2006 A Python Tutorial. Title. Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center. Kurt Schwehr 31 Oct 2006. http://docs.python.org/tut/. Where is python on my machine?. Fink for unix software. Fink Commander. Unstable packages are generally pretty stable.

Download Presentation

Title

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 31-Oct-2006 A Python Tutorial Title Center for Coastal and Ocean Mapping NOAA/UNH Joint Hydrographic Center 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. Unstable packages are generally pretty stable

  7. Emacs Cheat Sheet

  8. Setting up ~/.emacs

  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. Writing data to a file

  27. Old school - gnuplot

  28. Gnuplot in 3D

  29. Saving gnuplot to gif or pdf

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

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

  32. Making our code a proper function

  33. Function parameters can be specified by name

  34. Use this function from outside the file • Whoops - no documentation!

  35. Often it is good to give a parameter a default

  36. Add some ‘doc strings’

  37. Documentation as seen from ipython

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

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

  40. Adding more to the file

  41. Document the function

  42. Add command line options

  43. Plotting data with Gnuplot-py

More Related