Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40251
| Date | 2013-03-01 08:52 -0500 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2721.1362145995.2939.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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