Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31857
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.144 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.72; '*S*': 0.00; '21,': 0.07; 'oct': 0.16; 'later': 0.16; 'wrote:': 0.17; 'header:In-Reply-To:1': 0.25; 'wonder': 0.27; 'message-id:@mail.gmail.com': 0.27; 'faster,': 0.29; 'strings,': 0.29; 'probably': 0.29; 'that.': 0.30; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'faster': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; "i'll": 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'chance': 0.61; 'today.': 0.69; 'subject:get': 0.81; 'timings': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=sh4SC5VDiwvxfAWEtQxWiIC/hSbdJqkYB0A3+ZkVIXw=; b=oOo6zwPYXFB93THYdSVtY+K8fsrA99wQUWAEVq0p0t3yjAfNNpwMgOv0dFDpz1Th7l lcHkiL9IbzyWArXXfVEqap9HK54J+z4dRsdZihW0j/7hNb+Ffan2L0Wa55yha5vzif5k Fhxj8GoVw9A55l6ITnyqQy6MRoyfzqRBepvAej6cGQK4cYlwodVmABXevcgbBtug6a4X 6DNV258R1DrE123I2TwIAixED5gXt/RFzLjtvA98Kr5KM4b1JnNcBxCKniqdlFwWhoR3 T9AE3VIauG8ZdOIaz7GnhX6Rc/qFy0ryr17NO5Oa4p7B8m6V3MMzr7GHdxhgMOoA2Yh2 2yiw== |
| MIME-Version | 1.0 |
| In-Reply-To | <CALyJZZUui_Z_M6toRRiRmAhsGscCj_O0POw9Cb8Z8jOqW5O50g@mail.gmail.com> |
| References | <CALyJZZURWQxgPTQcQo8kOdHkaOYbB6YE=U=vi6VrX9FoDH1gAQ@mail.gmail.com> <k61fr6$s5m$1@ger.gmane.org> <CALyJZZUui_Z_M6toRRiRmAhsGscCj_O0POw9Cb8Z8jOqW5O50g@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Sun, 21 Oct 2012 13:06:11 -0600 |
| Subject | Re: get each pair from a string. |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2599.1350846404.27098.python-list@python.org> (permalink) |
| Lines | 14 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350846404 news.xs4all.nl 6887 [2001:888:2000:d::a6]:35414 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31857 |
Show key headers only | View raw
On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis <vincent@vincentdavis.net> wrote: > x = 'apple' > for f in range(len(x)-1): > print(x[f:f+2]) > > @Ian, > Thanks for that I was just looking in to that. I wonder which is faster I > have a large set of strings to process. I'll try some timings if I get a > chance later today. The solution you came up with is probably faster, but less general -- it will only work on sliceable sequences like strings, not arbitrary iterables.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: get each pair from a string. Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-21 13:06 -0600
csiph-web