有时,我想要print一个 numpy 数组,只是将其从命令行复制到其他地方。标准__repr__很接近,但缺少逗号:
import numpy as np
a = np.random.rand(5, 2)
print(a)
Run Code Online (Sandbox Code Playgroud)
[[0.66585668 0.5793219 ]
[0.28048686 0.11019737]
[0.41359919 0.69354774]
[0.02062253 0.85507001]
[0.05443759 0.51366551]]
Run Code Online (Sandbox Code Playgroud)
有什么提示吗?