# coding=utf8 s = 'abcde' i = -1 for i in range(-1, -len(s), -1): print(s[:i]) # 结果 ''' abcd abc ab a '''