How to format numbers/text to 2 decimal places?

I am using Elefront to generate text objects from a spreadsheet. I need these numbers to be displayed at 2 decimal places. They currently go from 0 to MANY decimal places. I can’t find a way to format numeric output to just 2 decimals. Feeling dumb - it could be Excel - or Grasshopper - or something in Notepad…


Hope it helps you out…


Thanks… Just what I needed.


Perhaps someone may find this useful so I thought I’d share. I wrote this Python script to make number formatting a bit more intuitive for my own uses. Note: the script only adds/ removes padding, it doesn’t do anything for exponents.

And FYI, below is s a link to David Rutten’s post on the subject on the old grasshopper site.
Ole (5.5 KB)

1 Like

And here is a more esoteric one about adding leading zeros in Python!

1 Like

i use this component



the Round component in Rhino 6 + Grasshopper 1.0.0007 does not look like that. Where did that one come from? Also, I can’t seem to get the desired results from the expression…

Feeling stupid.

1 Like

@rcmcdougle - that’s a Pufferfish component

OK - I don’t have Pufferfish installed. I solved the Expression failure. SubSet was putting out a string. Adding a Number component between SubSet and Expression fixed it.


You can use function

You can change the number in the function to however many decimals you desire.


My personal fave. Can use it to round to a floating point or the nearest multiple of an integer