从符号、数字和指数构造 decimal.Decimal

Construct decimal.Decimal from sign, digits and exponent

如果我已经有 decimal.Decimal,我可以检查 d.as_tuple().digitsd.as_tuple().exponent

但是如果我有数字和指数,我怎样才能有效地构造一个小数呢?

来自Decimal documentation

If value is a tuple, it should have three components, a sign (0 for positive or 1 for negative), a tuple of digits, and an integer exponent. For example, Decimal((0, (1, 4, 1, 4), -3)) returns Decimal('1.414').