Mega Code Archive

 
Categories / Python Tutorial / String
 

Take a string and display it in a loop

# Each time through we would like to chop off the last character.  s = 'abcde' i = -1 for i in range(-1, -len(s), -1):     print s[:i]