Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72796
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.090 |
| X-Spam-Evidence | '*H*': 0.83; '*S*': 0.01; 'subject:Python': 0.06; "'',": 0.07; 'suppose': 0.07; 'correct,': 0.09; 'line)': 0.16; 'perhaps:': 0.16; 'subject:Unicode': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'unicode': 0.24; 'header:In-Reply-To:1': 0.27; 'points': 0.29; 'message-id:@mail.gmail.com': 0.30; '"",': 0.31; 'though.': 0.31; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'remove': 0.60; 'removing': 0.60; 'more': 0.64; 'relatively': 0.65; 'line,': 0.68; 'skip:r 40': 0.68; 'captures': 0.84; 'standard:': 0.84; 'absolutely': 0.87; 'subject:you': 0.87 |
| 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=tf9YaQWdFpCYXoKmYk7o6vUEE8Bq1nE6SVNjY/M0d8Y=; b=u8GKByk696ASxFZSems70PGzCyjvBBzxu/6nzUKwoqtXDOSUbpUhnBu77amXy3kAB7 QCrdovjjAhaQ/5WxKTvCOZcl1tZ5jXddRVnDrm9T6BanaMOtMaiOSrsA/BUPkoqpyrFK o/E7voDnJD5EXZQzEYuJTu7JCKQLFHA9Peve8KJRvk64aCcclNEBJqD6e3F68fmhXIQ0 YfiyZ1zJ291D4OWnN9FsxFV344v4Zn1iwIQ+3XoMKuCrOtfJYASG2GIDVYiQw3LkieAL Hmx4NxbuyRLp2KcgcofeqxWDo8d1QTzlrFOC7N7fXUf20QtvnKFj+pkXH7vaHuJ1s215 khsw== |
| X-Received | by 10.194.243.104 with SMTP id wx8mr1530278wjc.32.1402013174267; Thu, 05 Jun 2014 17:06:14 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <1402000445.62825.YahooMailNeo@web163806.mail.gq1.yahoo.com> |
| References | <mailman.10656.1401842403.18130.python-list@python.org> <lmq4mu$8nv$1@news.albasani.net> <7xr433z0g3.fsf@ruckus.brouhaha.com> <lmqdn8$scl$1@news.albasani.net> <mailman.10759.1401998071.18130.python-list@python.org> <7xioof9li6.fsf@ruckus.brouhaha.com> <CALwzidm1mg6HunTrBmpcoRgePd=5Aa4=QQ-yEJVB_CAH5ZY+Fw@mail.gmail.com> <1402000445.62825.YahooMailNeo@web163806.mail.gq1.yahoo.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Thu, 5 Jun 2014 18:05:34 -0600 |
| Subject | Re: Unicode and Python - how often do you index strings? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.10791.1402013180.18130.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1402013180 news.xs4all.nl 2839 [2001:888:2000:d::a6]:47746 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:72796 |
Show key headers only | View raw
On Thu, Jun 5, 2014 at 2:34 PM, Albert-Jan Roskam <fomcl@yahoo.com> wrote:
>> If you want to be really picky about removing exactly one line
>> terminator, then this captures all the relatively modern variations:
>> re.sub('\r?\n$|\n?\r$', line, '', count=1)
>
> or perhaps: re.sub("[^ \S]+$", "", line)
That will remove more than one terminator, plus tabs. Points for
including \f and \v though.
I suppose if we want to be absolutely correct, we should follow the
Unicode standard:
re.sub(r'\r?\n$|[\r\v\f\x85\u2028\u2029]$', line, '', count=1)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unicode and Python - how often do you index strings? Chris Angelico <rosuav@gmail.com> - 2014-06-04 10:39 +1000
Re: Unicode and Python - how often do you index strings? Roy Smith <roy@panix.com> - 2014-06-03 21:18 -0400
Re: Unicode and Python - how often do you index strings? Chris Angelico <rosuav@gmail.com> - 2014-06-04 12:13 +1000
Re: Unicode and Python - how often do you index strings? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-04 18:48 +1200
Re: Unicode and Python - how often do you index strings? alister <alister.nospam.ware@ntlworld.com> - 2014-06-04 10:57 +0000
Re: Unicode and Python - how often do you index strings? alister <alister.nospam.ware@ntlworld.com> - 2014-06-04 10:50 +0000
Re: Unicode and Python - how often do you index strings? Rustom Mody <rustompmody@gmail.com> - 2014-06-04 05:52 -0700
Re: Unicode and Python - how often do you index strings? alister <alister.nospam.ware@ntlworld.com> - 2014-06-04 13:36 +0000
Re: Unicode and Python - how often do you index strings? wxjmfauth@gmail.com - 2014-06-03 23:50 -0700
Re: Unicode and Python - how often do you index strings? Michael Torrie <torriem@gmail.com> - 2014-06-04 08:50 -0600
Re: Unicode and Python - how often do you index strings? wxjmfauth@gmail.com - 2014-06-05 00:06 -0700
Re: Unicode and Python - how often do you index strings? Marko Rauhamaa <marko@pacujo.net> - 2014-06-05 10:20 +0300
Re: Unicode and Python - how often do you index strings? alister <alister.nospam.ware@ntlworld.com> - 2014-06-05 15:39 +0000
Re: Unicode and Python - how often do you index strings? Mark H Harris <harrismh777@gmail.com> - 2014-06-05 10:57 -0500
Re: Unicode and Python - how often do you index strings? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-05 18:15 +0100
Re: Unicode and Python - how often do you index strings? alister <alister.nospam.ware@ntlworld.com> - 2014-06-05 17:33 +0000
Re: Unicode and Python - how often do you index strings? Joshua Landau <joshua@landau.ws> - 2014-06-05 18:18 +0100
Re: Unicode and Python Rustom Mody <rustompmody@gmail.com> - 2014-06-04 21:25 -0700
Re: Unicode and Python wxjmfauth@gmail.com - 2014-06-05 00:23 -0700
Re: Unicode and Python - how often do you index strings? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-05 18:09 +0200
Re: Unicode and Python - how often do you index strings? Paul Rubin <no.email@nospam.invalid> - 2014-06-05 11:16 -0700
Re: Unicode and Python - how often do you index strings? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-05 20:42 +0200
Re: Unicode and Python - how often do you index strings? Ryan Hiebert <ryan@ryanhiebert.com> - 2014-06-05 13:52 -0500
Re: Unicode and Python - how often do you index strings? Paul Rubin <no.email@nospam.invalid> - 2014-06-05 12:58 -0700
Re: Unicode and Python - how often do you index strings? Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-05 14:18 -0600
Re: Unicode and Python - how often do you index strings? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-06 10:47 +0200
Re: Unicode and Python - how often do you index strings? Tim Chase <python.list@tim.thechases.com> - 2014-06-06 05:37 -0500
Re: Unicode and Python - how often do you index strings? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-06 11:52 +0000
Re: Unicode and Python - how often do you index strings? Albert-Jan Roskam <fomcl@yahoo.com> - 2014-06-05 13:34 -0700
Re: Unicode and Python - how often do you index strings? Roy Smith <roy@panix.com> - 2014-06-05 17:00 -0400
Re: Unicode and Python - how often do you index strings? Rustom Mody <rustompmody@gmail.com> - 2014-06-05 15:24 -0700
Re: Unicode and Python - how often do you index strings? Ned Deily <nad@acm.org> - 2014-06-05 15:57 -0700
Re: Unicode and Python - how often do you index strings? Roy Smith <roy@panix.com> - 2014-06-05 20:10 -0400
Re: Unicode and Python - how often do you index strings? Ned Deily <nad@acm.org> - 2014-06-05 17:43 -0700
Re: Unicode and Python - how often do you index strings? Grant Edwards <invalid@invalid.invalid> - 2014-06-06 14:20 +0000
Re: Unicode and Python - how often do you index strings? Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-05 18:05 -0600
Re: Unicode and Python - how often do you index strings? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-06 10:42 +0200
Re: Unicode and Python - how often do you index strings? Larry Hudson <orgnut@yahoo.com> - 2014-06-06 20:24 -0700
Re: Unicode and Python - how often do you index strings? Chris Angelico <rosuav@gmail.com> - 2014-06-06 05:59 +1000
Re: Unicode and Python - how often do you index strings? Ryan Hiebert <ryan@ryanhiebert.com> - 2014-06-05 15:05 -0500
csiph-web