string.split(separator=' ', maxsplit)
这个函数一般在string之后,作用是用','字符,来替换string中的separator,而maxsplit限制的替换的次数
我们常见的
x,y=input().split()#输入3 2
经过split处理后其实就是把空格变成了',',x,y=3,2,是不是有恍然大悟的感觉呢
当然,它处理分割符的功能也是如此
x,y=input(),split('-')#输入3-2
就是把'-'替换成了','以便更好的赋值