I'm building a web page and server for a TOF sensor What is a simple way to format the data so it shows up as 1 decimal place on the web page?
I tied in Python
I tried in the HTML index fileneither work, I'm brain locked right now!
I tied in Python
Code:
templateData = { 'title' : " My VL6180X TOF", 'range_mm' : range_mm #'range_mm' : range_mm.toFixed(1) does not work }Code:
<body> <h1>Welcome to my VL6180X/Flask App!</h1> <p>This message comes from an HTML template.</p> <p>The Range: {{ range_mm | round(1) }}mm</p> <div class="image-container"> <img src="static/Level01.jpg"> <div class="overlay-text">The Range: {{ range_mm }}mm</div> </div> </body>Statistics: Posted by OldPCGuy — Sun Feb 22, 2026 8:33 pm — Replies 2 — Views 43