# ScrollPhat HD query

**URL:** <https://forums.pimoroni.com/t/scrollphat-hd-query/8848>\
**Category:** Support\
**Created:** [October 6, 2018, 11:23am UTC](https://forums.pimoroni.com/t/scrollphat-hd-query/8848 "2018-10-06T11:23:35Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [October 8, 2018, 9:06am UTC](https://forums.pimoroni.com/t/scrollphat-hd-query/8848/4 "2018-10-08T09:06:05Z")

</div>

Look into `string.format` - [https://docs.python.org/3.1/library/string.html#formatspec](https://docs.python.org/3.1/library/string.html#formatspec)

The specification language is fairly opaque but you’ll only generally need a few useful snippets.

A whole number

```auto
>>> "{:03d}".format(100)
'100'
>>>

```

With leading zeros:

```auto
>>> "{:03d}".format(99)
'099'

```

Temperature (or a decimal number with 5 digits and 2 decimal places):

```auto
>>> "{:5.2f}".format(19.22)
'19.22'

```

Pressure (or a decimal number with 7 digits and 2 decimal places):

```auto
>>> "{:7.2f}".format(1020.22)
'1020.22'

```

And you can use these at any point in your text to add your number:

```auto
>>> "The temperature is {:5.2f}C".format(22.15)
'The temperature is 22.15C'

```

And, of course, from a variable too:

```auto
temperature = 19.2524
>>> "The temperature is {:5.2f}C".format(temperature)
'The temperature is 19.25C'

```

---

_[View the full topic](https://forums.pimoroni.com/t/scrollphat-hd-query/8848)._
