问题遇到的现象和发生背景 算法题,split出现unpack的问题
网页中算法题提交的显示没问题,但是在vs里面出问题
用代码块功能插入代码,请勿粘贴截图
A,B = input().split()
print(int(A) + int(B))
运行结果及报错内容
这是算法题,没问题
这是vs,有问题
显示的是unpack
网页中算法题提交的显示没问题,但是在vs里面出问题
A,B = input().split()
print(int(A) + int(B))
这是算法题,没问题
在VS里输入时,两个数之间是不是没有空格?如果没有空格,split()的结果只有1个元素
这是源码里的注释
def split(self, *args, **kwargs): # real signature unknown
"""
Return a list of the words in the string, using sep as the delimiter string.
sep
The delimiter according which to split the string.
// 默认以空白符分割
None (the default value) means split according to any whitespace,
and discard empty strings from the result.
maxsplit
Maximum number of splits to do.
-1 (the default value) means no limit.
"""
pass