使用h5py.special_dtype创建一个类型即可:

In [27]: dt = h5py.special_dtype(vlen=str)

In [28]: dset = h5File.create_dataset('str1', (100,), dtype=dt)

In [29]: dset[0] = 'Hello, hdf5'

In [30]: dset[0]
Out[30]: 'hello, hdf5'