Skip to content

Instantly share code, notes, and snippets.

@verybada
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save verybada/ce57be67e04fdaffef25 to your computer and use it in GitHub Desktop.

Select an option

Save verybada/ce57be67e04fdaffef25 to your computer and use it in GitHub Desktop.
How to reverse a string in python
def str_reverse(str):
return str[::-1]
test_str = "this is test string"
print "Origin string={}, after revert={}".format(test_str, str_reverse(test_str))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment