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


Groups > comp.lang.python > #40230

Re: text formatting question

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <idhayham@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:text': 0.05; 'subject:question': 0.08; 'friday,': 0.09; 'other,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'chris,': 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'lines': 0.28; 'chris': 0.28; 'case,': 0.29; 'character': 0.29; 'fri,': 0.30; 'error': 0.30; 'clarify': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'quite': 0.37; 'subject:: ': 0.38; '!!!': 0.62; 'great': 0.64; '2013': 0.84; 'divide': 0.84
X-Received by 10.50.12.227 with SMTP id b3mr841292igc.13.1362121737596; Thu, 28 Feb 2013 23:08:57 -0800 (PST)
Newsgroups comp.lang.python
Date Thu, 28 Feb 2013 23:08:57 -0800 (PST)
In-Reply-To <mailman.2703.1362120831.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=115.118.27.53; posting-account=gfbEvAoAAABSdsvW3U4v2kwqht99NNpd
References <0a6178f9-51ef-4edc-b87f-2631d667797f@googlegroups.com> <mailman.2703.1362120831.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 115.118.27.53
MIME-Version 1.0
Subject Re: text formatting question
From idy <idhayham@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
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>
Message-ID <mailman.2704.1362121746.2939.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362121746 news.xs4all.nl 6950 [2001:888:2000:d::a6]:33624
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40230

Show key headers only | View raw


On Friday, March 1, 2013 12:23:41 PM UTC+5:30, Chris Angelico wrote:
> On Fri, Mar 1, 2013 at 5:49 PM, idy <idhayham@gmail.com> wrote:
> 
> > Error = 'XYC.12345455LOcation/user/data/MYGLE-INGXYC.23344566LOcation/user/data/INGE-FTYXYC.22334566LOcation/user/data/GETN-YUNXYC.12345455LOcation/user/data/MYGLE-INGXYC.1111111LOcation/user/data/INGE-FTYXYC.3333333LOcation/user/data/GETN-YUN'
> 
> >
> 
> > I need to write this to mail body as with following format in multiple lines
> 
> >
> 
> > XYC.12345455-LOcation/user/data/MYGLE-ING
> 
> > XYC.23344566-LOcation/user/data/INGE-FTY
> 
> > XYC.22334566LOcation/user/data/GETN-YUN
> 
> > XYC.12345455LOcation/user/data/MYGLE-ING
> 
> > XYC.1111111LOcation/user/data/INGE-FTY
> 
> > XYC.3333333LOcation/user/data/GETN-YUN
> 
> 
> 
> You want to break the line immediately before the 'XYC'? That's quite
> 
> easy; the line break is a character like any other, and can be used in
> 
> a replace() call:
> 
> 
> 
> formatted_error = Error.replace("XYC","\nXYC")
> 
> 
> 
> If that's not the case, can you clarify what you need to do to divide it?
> 
> 
> 
> Chris Angelico

Chris,

Thanks this works great !!! 

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


Thread

text formatting question idy <idhayham@gmail.com> - 2013-02-28 22:49 -0800
  Re: text formatting question Chris Angelico <rosuav@gmail.com> - 2013-03-01 17:53 +1100
    Re: text formatting question idy <idhayham@gmail.com> - 2013-02-28 23:08 -0800
      Re: text formatting question Dave Angel <davea@davea.name> - 2013-03-01 08:52 -0500
      Re: text formatting question Chris Angelico <rosuav@gmail.com> - 2013-03-02 00:57 +1100
    Re: text formatting question idy <idhayham@gmail.com> - 2013-02-28 23:08 -0800

csiph-web