Reversing a string

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Jun 27 19:07:29 CEST 2007


Scott wrote:
> So how on earth would be the best way to: Write a function that takes a 
> string as an argument and outputs the letters backward, one per line.

Homework?

Anyway, what about:

  for c in string[::-1]:
      print c


Stefan



More information about the Python-list mailing list