如何在python中将数组str 32转换为数组int 32

我正在尝试使用以下代码将数组 str 32 转换为数组 int 32 但引发错误: int() with base 10: '' 的文字无效:请注意,我需要在 b 的值之间有一个空格作为输入


import numpy as np

a =np.array( (input('8')))

b =np.array((input('8 '' 6 '' 14 '' 7 '' 3 '' 2 '' 11 '' 10')))

c = b.astype(np.int)


慕哥6287543
浏览 121回答 1
1回答

一只甜甜圈

b = np.array(raw_input("input your number:").split()) c = b.astype(np.int)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python