【发布时间】:2021-05-16 10:58:21
【问题描述】:
如果输入数字,我需要选择前 3 个数字。 示例;
23456.43 = 234
7348593.8304853 = 734
1.097493 = 109
27.7481 = 277
如何在 Python 中做到这一点?
【问题讨论】:
-
str(your_input).replace('.','')[:3]? -
你知道输入是浮点数还是字母?
-
Stack Overflow 并非旨在取代现有的教程和文档。请重复有关字符串处理的材料。
-
这能回答你的问题吗? Get most significant digit in python
标签: python time-series artificial-intelligence data-mining finance