x[::3] x[::2].replace('e','')
x = " abcdefg" s1 =x[0] + x[1::3] # 注意空格 s2 = x[:2] + x[3::4] print("s1={}".format(s1)) print("s2={}".format(s2))
结果:
如果觉得答案对你有帮助,请点击下采纳,谢谢~