Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Created July 8, 2019 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyaltrabelsi/6235848d437d58770ff2d72ce7a1f4e2 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/6235848d437d58770ff2d72ce7a1f4e2 to your computer and use it in GitHub Desktop.
Python trick reversing "ordered" iterable
# Reversing string
>>> s = "abc"
>>> s[::-1]
"cba"
# Reversing list
>>> l = ["a", "b", "c"]
>>> l[::-1]
["c", "b", "a"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment