Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8. Go directly to the new manual page here
Created on Sun Jun 23 13:40:19 2013
@author: pietro
Return a html repr of a dictionary.
Parameters: |
|
---|
>>> dic = {'key 0': 0, 'key 1': 1}
>>> print dict2html(dic)
<table>
<tr>
<td>key 0</td>
<td>0</td>
</tr>
<tr>
<td>key 1</td>
<td>1</td>
</tr>
</table>
>>> print dict2html(dic, border="1")
<table border='1'>
<tr>
<td>key 0</td>
<td>0</td>
</tr>
<tr>
<td>key 1</td>
<td>1</td>
</tr>
</table>
>>> print dict2html(dic, kdec='b', vfmt='%05d', vdec='i')
<table>
<tr>
<td><b>key 0</b></td>
<td><i>00000</i></td>
</tr>
<tr>
<td><b>key 1</b></td>
<td><i>00001</i></td>
</tr>
</table>
>>> dic = {'key 0': (2, 3), 'key 1': (10, 5)}
>>> print dict2html(dic, kdec='b', vdec='i',
... vfun=lambda x: "%d<sup>%.1f</sup>" % x)
<table>
<tr>
<td><b>key 0</b></td>
<td><i>2<sup>3.0</sup></i></td>
</tr>
<tr>
<td><b>key 1</b></td>
<td><i>10<sup>5.0</sup></i></td>
</tr>
</table>
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8. Go directly to the new manual page here
Help Index | Topics Index | Keywords Index | Full Index
© 2003-2020 GRASS Development Team, GRASS GIS 7.6.2dev Reference Manual