关于python中数字字符串转变数组的方法
代码示例
1、
num = input()
nums = list(map(int,num))
print(nums)】
输出:[1, 2, 3]
2、
num = input()
nums = list(map(int,num.split()))
print(nums)
输出 :[123]
#其中split:split() 通过指定分隔符对字符串进行切片,如果参数 num 有指定值,则仅分隔 n...
原创
2020-02-15 13:50:34 ·
658 阅读 ·
0 评论