Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75202
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; '[0,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'python': 0.11; "':'": 0.16; '...,': 0.16; 'matlab': 0.16; 'range(0,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'slicing:': 0.16; 'subject:array': 0.16; 'index': 0.16; '>>>': 0.22; 'header:User- Agent:1': 0.23; '15,': 0.26; 'header:X-Complaints-To:1': 0.27; 'array': 0.29; 'writes:': 0.31; 'subject:with': 0.35; 'subject:?': 0.36; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'range': 0.61; 'here': 0.66; '(while': 0.84; 'received:89': 0.85 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Akira Li <4kir4.1i@gmail.com> |
| Subject | Re: How to index an array with even steps? |
| Date | Fri, 25 Jul 2014 16:02:48 +0400 |
| References | <9160a3c5-ff5f-4fb2-a125-4a1be28438b9@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| X-Gmane-NNTP-Posting-Host | 89.169.229.68 |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
| Cancel-Lock | sha1:5iJ5ILvAE8xzSeWXGqYSu8oFTtk= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12314.1406289784.18130.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406289784 news.xs4all.nl 2941 [2001:888:2000:d::a6]:54758 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75202 |
Show key headers only | View raw
fl <rxjwg98@gmail.com> writes: > In Python, ':' is used to indicate range (while in Matlab I know it can be used > to control steps). How to index an array with 0, 5, 10, 15...995? Just use slicing: >>> L = range(1000) # your array goes here >>> L[::5] [0, 5, 10, 15, ..., 995] # Python 2 range(0, 1000, 5) # Python 3 -- Akira
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
How to index an array with even steps? fl <rxjwg98@gmail.com> - 2014-07-25 04:45 -0700 Re: How to index an array with even steps? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-25 11:55 +0000 Re: How to index an array with even steps? fl <rxjwg98@gmail.com> - 2014-07-25 04:56 -0700 Re: How to index an array with even steps? Akira Li <4kir4.1i@gmail.com> - 2014-07-25 16:02 +0400
csiph-web