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


Groups > comp.lang.python > #40251

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 <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'string.': 0.04; 'subject:text': 0.05; '*not*': 0.07; 'subject:question': 0.08; 'friday,': 0.09; 'other,': 0.09; 'spec': 0.09; 'do,': 0.15; "chris'": 0.16; 'chris,': 0.16; 'mangled': 0.16; 'reliably': 0.16; 'wrote:': 0.17; 'string,': 0.17; '>>>': 0.18; 'somebody': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'am,': 0.27; 'lines': 0.28; 'chris': 0.28; 'separated': 0.29; 'case,': 0.29; 'character': 0.29; 'suggestion': 0.32; 'anywhere': 0.33; 'clarify': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'thanks': 0.34; 'but': 0.36; 'characters': 0.36; 'data.': 0.36; 'quite': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'most': 0.61; '!!!': 0.62; 'great': 0.64; 'received:74.208': 0.71; '2013': 0.84; 'divide': 0.84; 'candidate,': 0.95
Date Fri, 01 Mar 2013 08:52:58 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: text formatting question
References <0a6178f9-51ef-4edc-b87f-2631d667797f@googlegroups.com> <mailman.2703.1362120831.2939.python-list@python.org> <0a682b8c-34dd-4f45-b834-76c9f83d866d@googlegroups.com>
In-Reply-To <0a682b8c-34dd-4f45-b834-76c9f83d866d@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:HitTqSw7B6EwhBK0KjexudFCE1UXDwozYjyVd7pxirM WLMmarvlBVutiOzo3VmVcuFGscMz5NRT8z0bCaGjz2DooyQqTK eAwc/8m6KekcnFSaPUQ19BXlZkM+TZH2vau1MkjxwR4/hM9MGL pH/Zu5FGWlNyWpI5S424fTUz6eVGcXcN1vkbGrHscQMVRPMooq X4ineyga4FvHI+fFDawpwvvFL0TzFPReZ6LBwkvLoIiwQaKv+9 tw9XQA1s7PYxi200bewr6KaXVAiUjzChP69JyL7Z6YbG6zKic7 gaaLpRq4l4972aO7F1FrUgpbXgRdS3dMZBqo+Fe9G8lgpUcvw= =
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.2721.1362145995.2939.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362145995 news.xs4all.nl 6955 [2001:888:2000:d::a6]:55355
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40251

Show key headers only | View raw


On 03/01/2013 02:08 AM, idy wrote:
> On Friday, March 1, 2013 12:23:41 PM UTC+5:30, Chris Angelico wrote:
>>
>>
>>>   <snip>
>>
>> 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 !!!
>

The assumption Chris made is that the characters XYC do *not* appear 
anywhere else in each string.  if they do, then you need to write a spec 
as to what criteria you can count on for the data.

If somebody has mangled all those lines into one long string, it's quite 
likely that they CANNOT be reliably separated again.  Chris' suggestion 
is the most likely candidate, but ...
-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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