为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

慕哥6287543 2023-08-08 14:55:36
我正在尝试使用以下代码将数组 str 32 转换为数组 int 32 但引发错误: int() with base 10: '' 的文字无效:请注意,我需要在 b 的值之间有一个空格作为输入import numpy as npa =np.array( (input('8')))b =np.array((input('8 '' 6 '' 14 '' 7 '' 3 '' 2 '' 11 '' 10')))c = b.astype(np.int)
查看完整描述

1 回答

?
一只甜甜圈

TA贡献1836条经验 获得超5个赞

b = np.array(raw_input("input your number:").split())
c = b.astype(np.int)


查看完整回答
反对 回复 2023-08-08
  • 1 回答
  • 0 关注
  • 61 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信