#!/usr/bin/python -tti print 'creating a file and writing some data to it' import h5py f = h5py.File('myfile.h5', 'w') dset = f.create_dataset('test', (100,100,100), 'i') dset[...] = 42 f.close() del f del dset print 'file is now closed and all variables are deleted ...' # ---------------------------------------------------------------------------- print 'reopening file for read access -- as variable f' f = h5py.File('myfile.h5', 'r') print 'type f.items() to look at its contents,' print 'retrieve the contents, as you would with a dict' print 'e.g. f[]' print 'you can even access only part of the contents' print 'use slicing for this:' print 'e.g. f[][23,10:20]'