在Python中,输出派(π)可以通过使用`print`函数实现。以下是使用`print`函数输出π的几种方法:
1. 使用内置的`math`库中的`pi`常量:
```python
import math
print(math.pi)
2. 使用`print`函数和字符串格式化:
```python
print("π is approximately equal to {:.2f}".format(math.pi))
3. 使用f-string(Python 3.6及以上版本支持):
```python
print(f"π is approximately equal to {math.pi:.2f}")
以上代码都会输出π的近似值,保留两位小数。