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!!
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!!
RSS feed for comments on this post. TrackBack URI
good thnx
Comment by eli — May 22, 2009 @ 8:26 am |