对于字符串:str1=‘SDUTCSSEno1’,欲获得切片:‘1onESS’,怎么办
str1='SDUTCSSEno1' print(str1[-1:-7:-1])
str1='SDUTCSSEno1' str2=str1[::-1] #反转顺序 str2[:6] #切片前六位
str1= 'SDUTCSSEno1' res = str1[-1:-7:-1] print(res)
如果觉得答案对你有帮助,请点击下采纳,谢谢~