소프트웨어/python

list에서 짝수 홀수 출력하기

개발자_이훈규 2015. 9. 15. 11:57

Reference : http://desk.stinkpot.org:8080/tricks/index.php/2007/10/extract-odd-or-even-elements-from-a-python-list/


 제가 채택한 방법은요,


x = range(1, 10)

x[::2]

x[1::2]