Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50900

Find and Replace Simplification

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <devyncjohnson@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.180
X-Spam-Level *
X-Spam-Evidence '*H*': 0.66; '*S*': 0.02; "'',": 0.07; 'header:User- Agent:1': 0.23; 'code': 0.31; 'received:10.0.0': 0.31; 'once,': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'received:10.0': 0.36; 'received:10': 0.37; 'tasks': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'more': 0.64; 'subject:skip:S 10': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=ZYwF1wDSXg9kkz1k1slNFJqApcIgl3R1Gle/mfowppE=; b=Q0PNxK1hnBxWmG+lbi8aiz/4zl0lg7hzggti8s2YQyTclrCqfXW2btAzjr4JmEWEI7 DiIrEU/aXLSTdJVXgo7oBrPOBm2yuMLnIVoSSCrSoLzC3OhP48RLu8xlqrVMSTd9wyJE 9rPGYvxPAZ+h9jQ7El/4LFkT5nulTocUem0okzmz247ise0fPPKY6EErh6gMxdOXrefY em23OGFn3x/TR+fZJUrWdrJg765CX47vbgVMHegfBd2XhoYdrzD00oktH91fLqskFmxH UcwGLbC38eOmcJo7IH9hhNR14NZZUqM/syxx7edXAwDknC69g4KQ3QxNgihUTGRreBkY unQg==
X-Received by 10.43.91.73 with SMTP id bl9mr10310657icc.17.1374240171105; Fri, 19 Jul 2013 06:22:51 -0700 (PDT)
Date Fri, 19 Jul 2013 09:22:48 -0400
From Devyn Collier Johnson <devyncjohnson@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7
MIME-Version 1.0
To Python Mailing List <python-list@python.org>
Subject Find and Replace Simplification
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.4865.1374240179.3114.python-list@python.org> (permalink)
Lines 8
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374240179 news.xs4all.nl 15899 [2001:888:2000:d::a6]:52728
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50900

Show key headers only | View raw


I have some code that I want to simplify. I know that a for-loop would 
work well, but can I make re.sub perform all of the below tasks at once, 
or can I write this in a way that is more efficient than using a for-loop?

DATA = re.sub(',', '', 'DATA')
DATA = re.sub('\'', '', 'DATA')
DATA = re.sub('(', '', 'DATA')
DATA = re.sub(')', '', 'DATA')

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 09:22 -0400
  Re: Find and Replace Simplification Novocastrian_Nomad <gregory.j.baker@gmail.com> - 2013-07-19 06:38 -0700
  Re: Find and Replace Simplification John Gordon <gordon@panix.com> - 2013-07-19 14:28 +0000
  Re: Find and Replace Simplification Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-19 16:22 +0000
    Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-19 20:29 +0300
    Re: Find and Replace Simplification Skip Montanaro <skip@pobox.com> - 2013-07-19 13:08 -0500
    Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-19 17:44 -0400
    Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-19 18:45 -0400
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 12:16 +0100
    Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-20 14:48 +0300
    Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-20 14:57 +0300
    Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:41 -0400
    Re: Find and Replace Simplification Devyn Collier Johnson <devyncjohnson@gmail.com> - 2013-07-20 08:50 -0400
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 18:03 +0100
    Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-20 14:04 -0400
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 19:37 +0100
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 19:41 +0100
    Re: Find and Replace Simplification Dave Angel <davea@davea.name> - 2013-07-20 17:56 -0400
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-20 23:33 +0100
    Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-21 10:44 +0300
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-21 12:29 +0100
    Re: Find and Replace Simplification Serhiy Storchaka <storchaka@gmail.com> - 2013-07-21 15:28 +0300
    Re: Find and Replace Simplification Joshua Landau <joshua@landau.ws> - 2013-07-21 13:49 +0100

csiph-web