1. 使用内置函数 `round()`
```python
a = 3.
方法一:使用 round() 函数
b = round(a, 2)
print(b) 输出:3.14
2. 使用字符串格式化
```python
a = 3.
方法二:使用字符串格式化
print('%.2f' % a)
方法三:使用 f-string 格式化
print(f'{a:.2f}')
3. 使用 `decimal.Decimal` 类
```python
from decimal import Decimal
a = Decimal('3.')
方法四:使用 decimal.Decimal 类的 as_tuple() 方法
e = abs(a.as_tuple().exponent)
print(e) 输出:小数点后的位数
4. 使用正则表达式
```python
import re
a = '3.'
方法五:使用正则表达式提取小数点
pattern = r'\d+\.\d+'
result = re.findall(pattern, a)
print(result) 输出:['3.']
以上方法可以帮助你找到小数位数。请选择适合你需求的方法进行操作