pythonReverse a list using slicing
list_a = ["foo", "bar", "baz"]
list_reversed = list_a[::-1]
print(list_reversed)
ctrl + c
[::-1] slicing operator where the index is accessed as |
More of Python
- How to swap two variables values
- Combine multiple txt files into one
- How to split string by space
- How to use proxy
- How to add an element to the list
- How to get data from Mysql
- How to set environment variables
- How to get yesterday's date
- How to get minutes from datetime
- One-liner if else
See more codes...