Re: [Tutor] How to split string into separate lines

2014-12-04 Thread Lifeng Lin
would this work? >>> a="fe01b8412756fe02fe01b9416239fe02fe01ba41ad88fe02fe01bb41e8e7fe02fe01bc4112fbfe02fe01bd415794fe02" >>> b=a.replace('fe02fe01','fe02\nfe01').split('\n') >>> for c in b: ... p

Re: [Tutor] How to split string into separate lines

2014-12-04 Thread Alex Kleider
On 2014-12-03 21:36, shweta kaushik wrote: Hi Joel, Yes all lines start with fe01 and ends with fe02. Might this problem not be more easily solved using the re module? import re pat_obj = re.compile(r'fe01[0-9a-f]+?fe02') my_list = pat_obj.findall(string2split) I tried few things and able t

Re: [Tutor] How to split string into separate lines

2014-12-04 Thread shweta kaushik
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" wrote: > On Wed, Dec

Re: [Tutor] How to split string into separate lines

2014-12-03 Thread Alan Gauld
On 03/12/14 18:18, shweta kaushik wrote: I need help for doing this task. I know it will be simple but I am not able to do it. Your description of the task is not very precise so I'll make some guesses below. output_message_packet= fe01b8412756fe02fe01b9410 I want to

Re: [Tutor] How to split string into separate lines

2014-12-03 Thread Joel Goldstick
On Wed, Dec 3, 2014 at 1:18 PM, shweta kaushik 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= > fe01b8412756fe02fe01b9416239fe02fe01ba41ad88fe02fe01bb410

[Tutor] How to split string into separate lines

2014-12-03 Thread shweta kaushik
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= fe01b8412756fe02fe01b9416239fe02fe01ba41ad88fe02fe01bb41e8e7fe02fe01bc4112fbfe02fe01bd41