Monday, January 5, 2009

Useful python code for blogspot users like me

The big grief I have with blogspot is that it does not give you an easy way to display code, especially when it comes to XML. Well, that is now accounted for thanks to a handy script by the notable Davide Muzzarelli.

So instead of this (view the source to see the XML instead of just numbers):


65
20
300
2400
300
25
50


You get this:

<daily-values>
<total-fat units="g">65</total-fat>
<saturated-fat units="g">20</saturated-fat>
<cholesterol units="mg">300</cholesterol>
<sodium units="mg">2400</sodium>
<carb units="g">300</carb>
<fiber units="g">25</fiber>
<protein units="g">50</protein>
</daily-values>

Thank you so much Davide!!!

1 comment:

Davide Muzzarelli said...

Just a little and fast script ;)
Thank you Daniel for sharing it and for your others useful tips :)