Mega Code Archive

 
Categories / Python Tutorial / List
 

Revese and skip

s = 'abcdefgh' print s[::-1]            # think of it as 'reverse' print s[::2]             # think of it as skipping by 2