1. 使用`print`函数:
a = [1, 2, 3, 4]print(', '.join(str(i) for i in a)) 输出结果为:1, 2, 3, 4
2. 使用`numpy`库:
import numpy as npa = np.array([1, 2, 3])np.set_printoptions(precision=3) 设置精度print(a) 输出结果为:[1. 2. 3.]

3. 使用`sys.stdout.write`进行输出:
import sysa = [1, 2, 3, 4]sys.stdout.write(', '.join(str(i) for i in a) + '\n') 输出结果为:1, 2, 3, 4
4. 使用`matplotlib`库进行可视化输出(如果需要可视化):
import matplotlib.pyplot as plta = [1, 2, 3, 4]plt.plot(a)plt.show()
以上方法可以帮助你在Python中输出数组。
