Just use the slice and reverse it.
a[2:4] = a[2:4][::-1]
More Related Contents:
- Break outside the loop
- Pandas percentage of total with groupby
- Element-wise addition of 2 lists?
- How to explode a list inside a Dataframe cell into separate rows
- Controlling mouse with Python
- Transpose column to row with Spark
- Unable to locate element using selenium chrome webdriver in python selenium
- List comprehension vs generator expression’s weird timeit results?
- ‘Conda’ is not recognized as internal or external command
- Let JSON object accept bytes or let urlopen output strings
- How to use a (random) *.otf or *.ttf font in matplotlib?
- Adding labels in x y scatter plot with seaborn
- How to invoke pandas.rolling.apply with parameters from multiple column?
- List of all unique characters in a string?
- How to generate random strings in Python?
- How do I check if raw input is integer in python 2.7?
- What is %pylab?
- Is there a difference between using a dict literal and a dict constructor?
- How to get unique values from multiple columns in a pandas groupby
- Merge a list of pandas dataframes
- interactive shell debugging with pycharm
- How to repeat a Pandas DataFrame?
- Django equivalent of PHP’s form value array/associative array
- Remove duplicates in list of object with Python
- Hide external modules when importing a module (e.g. regarding code-completion)
- Creating a dictionary with list of lists in Python
- How to store and retrieve a dictionary with redis
- List files on SFTP server matching wildcard in Python using Paramiko
- Get data from Twitter using Tweepy and store in csv file
- How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?