简体   繁体   中英

precision in python for

I have number f = 2.25e-06 and I want to print it in format

 2.250000e-6

can someone help?

'{:.6e}'.format(f) # format f exponentially using a base of 6 decimal places

使用科学格式

print("%e.6" %f)

Use

print format(a[0]/a[1], '.8f)

with the '8f' being how many decimal places you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM