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: 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: 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> 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 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 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 !!!