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
- One-liner calculator
- How to read yaml file
- How to generate a random secret key in hexadecimal
- How to split string by length
- How to shuffle list
- How to open CSV file
- How to split string by space
- How to get class name of an object
- How to execute python file
- How to check if list is empty
See more codes...