Abbysays’s Weblog

November 26, 2008

String Reverse in Python

One line code to reverse a string in Python:

strOrig = “xyz”

revStr = s[::-1]

where ’strOrig’ is the source string and ‘revStr’ is the string reversed.

Python is indeed powerful!!

1 Comment »

  1. good thnx

    Comment by eli — May 22, 2009 @ 8:26 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.