format#

Variable.format(format)#

Retrieve the string value with the specified numerical formatting.

Parameters:
formatstr

Format for the numeric value of the string. For example, '06.2f'. For more information, see the PyFormat documentation.

Returns:
str

String value with the specified numerical formatting.

Examples

>>> from ansys.aedt.core.application.variables import Variable
>>> v = Variable("10W")
>>> assert v.format("f") == '10.000000W'
>>> assert v.format("06.2f") == '010.00W'
>>> assert v.format("6.2f") == ' 10.00W'