I'd like to ask you a question about the Python string formatting decimal pointPlease let me know

Asked 2 years ago, Updated 2 years ago, 14 views

>>> a=10

>>> b=20

>>> "a/b is %0.6f"%(a/b)

'a/b' is 0.500,000'

>>> "a/b is %".6f"%(a/b)

'a/b' is 0.500,000'

"a/b is 0.500000" comes out What's the difference between making the input 0.6 and making it 0.6 above?

python

2022-09-22 20:06

1 Answers

Wouldn't there be no difference?

In general, I understand that a decimal representation can be either .x or 0.x.


2022-09-22 20:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.