Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python every other goes to a list

a = [1, 2, 3, 4, 5]
a[1::2]
# returns 2, 4
a[::2]
#returns 1, 3, 5
Comment

PREVIOUS NEXT
Code Example
Python :: drop second column pandas 
Python :: middle value of a list in python 
Python :: cross validation python 
Python :: how to use colorama 
Python :: coronavirus tips 
Python :: python global site packages 
Python :: python list flatten 
Python :: python wsgi server 
Python :: how to get the year in python 
Python :: union df pandas 
Python :: add a title to pandas dataframe 
Python :: python math cube root 
Python :: pyqt5 latex 
Python :: python print dict new line 
Python :: schedule asyncio python 
Python :: python install gimp 
Python :: next day in python without using datetime 
Python :: python color text console 
Python :: read binary file python 
Python :: pandas to dict by row 
Python :: number 1 
Python :: find nan values in a column pandas 
Python :: pyautogui pause in python 
Python :: Python find max in list of dict by value 
Python :: python timedelta 
Python :: django sort queryset 
Python :: qlabel alignment center python 
Python :: powershell get list of groups and members 
Python :: how to install python 2 
Python :: remove last element from dictionary python 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =