字符串的分段组合问题 问题: 用户输入一个字符串s,以字符减号(+)分割s,将其中的首尾段用加号(-)组合输出 如表输入输出: 输入输出Learning+python+is+a+great+choiceLeaning-choice1+2+3+4+5+6+7+81-8s = input(); str = s.split("+") print("{}-{}".format(str[0],str[-1])) 涉及知识点:split()方法,format()方法