[Tutor] How to split string into separate lines
shweta kaushik
coolshwetu at gmail.com
Thu Dec 4 06:36:57 CET 2014
Hi Joel,
Yes all lines start with fe01 and ends with fe02.
I tried few things and able to split it as list and then I want to split it
into bytes of two like s= fe 01 but when I am taking s[0] then it is
giving only f instead of fe.
On 04-Dec-2014 3:47 am, "Joel Goldstick" <joel.goldstick at gmail.com> wrote:
> On Wed, Dec 3, 2014 at 1:18 PM, shweta kaushik <coolshwetu at gmail.com>
> wrote:
> > Hi,
> >
> > I need help for doing this task. I know it will be simple but I am not
> able
> > to do it.
> >
> > output_message_packet=
> >
> fe01b84100000000000000002756fe02fe01b94100000000000000006239fe02fe01ba410000000000000000ad88fe02fe01bb410000000000000000e8e7fe02fe01bc41000000000000000012fbfe02fe01bd4100000000000000005794fe02
> >
> > I want to split this into separate message packets like this:
> > fe01b84100000000000000002756fe02
> > fe01b94100000000000000006239fe02
> > fe01ba410000000000000000ad88fe02
> > fe01bb410000000000000000e8e7fe02
> > fe01bc41000000000000000012fbfe02
> > fe01bd4100000000000000005794fe02
> >
> > After this I want to split this into bytes:
> > fe 01 b8 41 00 00 00 00 00 00 00 00 27 56 fe 02
> >
> > Please help me with code for how to do this.
> >
> > Thanks in advance.
> >
> > Regards,
> > Shweta
> >
>
> Look up python string methods to start.
>
> Does each line start with fe01?
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --
> Joel Goldstick
> http://joelgoldstick.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141204/a004a087/attachment.html>
More information about the Tutor
mailing list