Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40230
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-02-28 23:08 -0800 |
| References | <0a6178f9-51ef-4edc-b87f-2631d667797f@googlegroups.com> <mailman.2703.1362120831.2939.python-list@python.org> |
| Subject | Re: text formatting question |
| From | idy <idhayham@gmail.com> |
| Message-ID | <mailman.2704.1362121746.2939.python-list@python.org> (permalink) |
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 | Next — Previous 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