Skip to content

Instantly share code, notes, and snippets.

@puneetlakhina
Created October 20, 2011 07:31
Show Gist options
  • Save puneetlakhina/1300610 to your computer and use it in GitHub Desktop.
Save puneetlakhina/1300610 to your computer and use it in GitHub Desktop.
Python reverse a string
#!/usr/bin/python
import sys
s = sys.argv[1]
n=len(s)
print ''.join([s[i] for i in range(n-1,-1,-1)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment