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 split string by length
- Join list elements into string
- How to merge two lists
- How to format datetime
- How to remove specific file
- How to swap two variables values
- How to split string by space
- How to open CSV file
- How to get minutes from datetime
- Remove duplicate words from string
See more codes...