Download presentation
Presentation is loading. Please wait.
Published byKatrina Summers Modified over 9 years ago
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
Unstable packages are generally pretty stable
7
Emacs Cheat Sheet
8
Setting up ~/.emacs
10
Getting started
11
Strings
12
Getting help with the ‘tab’ key
13
More string operations
14
Lists are created with [ ]
15
The math module
16
Getting help on functions
17
More help
18
from math import *
19
The Decimal module
20
Converting between strings and numbers
21
If tests and indentation matters
22
for loops
23
Reading a file Adding a comma prevents the extra new line
24
Reading numbers from a file
25
A quick intro to time
26
Getting to the web documentation
28
Writing data to a file
29
Old school - gnuplot
30
Gnuplot in 3D
31
Saving gnuplot to gif or pdf
32
Writing a python file (aka module) env finds python in your path chmod +x dump.py./dump.py
33
Handling programs in a better way __name__ is set to main if the file is being executed
34
Making our code a proper function
35
Function parameters can be specified by name
36
Use this function from outside the file Whoops - no documentation!
37
Often it is good to give a parameter a default
38
Add some ‘doc strings’
39
Documentation as seen from ipython
40
Epydoc is Kurt’s favorite way to document python code Epydoc imports your file and creates html documentation
41
Here is the initial edydoc page Nice, but could be better Use markups in the doc string to tell epydoc more
42
Adding more to the file
43
Document the function
44
Add command line options
45
Plotting data with Gnuplot-py
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.