Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Denis McMahon
On Sat, 16 May 2015 06:28:19 -0700, bruceg113355 wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n 002 : some hexadecimal text > ... \n 003 : some hexadecimal text ... \n ... > 010 : some hexadeci

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Cameron Simpson
On 16May2015 10:35, bruceg113...@gmail.com wrote: On Saturday, May 16, 2015 at 12:59:19 PM UTC-4, Chris Angelico wrote: On Sun, May 17, 2015 at 2:22 AM, wrote: > # Original Approach > # - > ss = ss.split("\n") > ss1 = "" > for sdata in ss: > ss1 = ss1 + (sdata[OFFSET:] + "

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 12:59:19 PM UTC-4, Chris Angelico wrote: > On Sun, May 17, 2015 at 2:22 AM, wrote: > > # Original Approach > > # - > > ss = ss.split("\n") > > ss1 = "" > > for sdata in ss: > > ss1 = ss1 + (sdata[OFFSET:] + "\n") > > > > > > # Chris's Approach > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Chris Angelico
On Sun, May 17, 2015 at 2:22 AM, wrote: > # Original Approach > # - > ss = ss.split("\n") > ss1 = "" > for sdata in ss: > ss1 = ss1 + (sdata[OFFSET:] + "\n") > > > # Chris's Approach > # > lines = ss.split("\n") > new_text = "\n".join(line[8:] for line in line

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Irmen de Jong
On 16-5-2015 18:24, bruceg113...@gmail.com wrote: > Data is coming from a wxPython TextCtrl widget. Hm, there should be a better source of the data before it ends up in the textctrl widget. > The widget is displaying data received on a serial port for a user to analyze. If this is read from a s

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Ian Kelly
On Sat, May 16, 2015 at 10:22 AM, wrote: > # Chris's Approach > # > lines = ss.split("\n") > new_text = "\n".join(line[8:] for line in lines) Looks like the approach you have may be fast enough already, but I'd wager the generator expression could be replaced with: map(oper

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 11:13:45 AM UTC-4, Rustom Mody wrote: > On Saturday, May 16, 2015 at 8:30:02 PM UTC+5:30, Grant Edwards wrote: > > On 2015-05-16, bruceg113355 wrote: > > > > > I have a string that contains 10 million characters. > > > > > > The string is formatted as: > > > > > > "000

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 10:06:31 AM UTC-4, Stefan Ram wrote: > bruceg113...@gmail.com writes: > >Your approach using .join is what I was looking for. > > I'd appreciate a report of your measurements. # Original Approach # - ss = ss.split("\n") ss1 = "" for sdata in ss:

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Rustom Mody
On Saturday, May 16, 2015 at 8:30:02 PM UTC+5:30, Grant Edwards wrote: > On 2015-05-16, bruceg113355 wrote: > > > I have a string that contains 10 million characters. > > > > The string is formatted as: > > > > "001 : some hexadecimal text ... \n > > 002 : some hexadecimal text ... \n > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Grant Edwards
On 2015-05-16, bruceg113...@gmail.com wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 9:46:17 AM UTC-4, Chris Angelico wrote: > On Sat, May 16, 2015 at 11:28 PM, wrote: > > I have a string that contains 10 million characters. > > > > The string is formatted as: > > > > "001 : some hexadecimal text ... \n > > 002 : some hexadecimal text ... \n >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Chris Angelico
On Sat, May 16, 2015 at 11:28 PM, wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text ...

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread Joel Goldstick
On Sat, May 16, 2015 at 9:28 AM, wrote: > I have a string that contains 10 million characters. > > The string is formatted as: > > "001 : some hexadecimal text ... \n > 002 : some hexadecimal text ... \n > 003 : some hexadecimal text ... \n > ... > 010 : some hexadecimal text ...

Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
I have a string that contains 10 million characters. The string is formatted as: "001 : some hexadecimal text ... \n 002 : some hexadecimal text ... \n 003 : some hexadecimal text ... \n ... 010 : some hexadecimal text ... \n 011 : some hexadecimal text ... \n" and I need the