Last active
August 29, 2015 14:12
-
-
Save verybada/ce57be67e04fdaffef25 to your computer and use it in GitHub Desktop.
How to reverse a string in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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