Re: a string problem

2006-06-13 Thread Mitja Trampus
John Salerno wrote: > [EMAIL PROTECTED] wrote: >> hi >> >> if i have a some lines like this >> a ) "here is first string" >> b ) "here is string2" >> c ) "here is string3" >> >> When i specify i only want to print the lines that contains "string" ie > ... > And I'm actually ashamed to admit that I

Re: a string problem

2006-06-13 Thread Maric Michaud
Le Mardi 13 Juin 2006 15:59, John Salerno a écrit : > And I'm actually ashamed to admit that I know the RE way, but not the > regular string manipulation way, if there is one! eheh, In [39]: import string In [40]: sub, s1, s2 = 'string', 're string2, ,string1', 're string2, ,string' In [41]: su

Re: a string problem

2006-06-13 Thread Rune Strand
[EMAIL PROTECTED] wrote: > hi > > if i have a some lines like this > a ) "here is first string" > b ) "here is string2" > c ) "here is string3" > > When i specify i only want to print the lines that contains "string" ie > the first line and not the others. If i use re module, how to compile > the

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > > just curious , if RE has the \b and it works, can we look into the > > source of re and see how its done for \b ? > > I had a look in the sre module (which re seems to import), but I > couldn't find much. I'm not the best at analyzing source cod

Re: a string problem

2006-06-13 Thread John Salerno
[EMAIL PROTECTED] wrote: > just curious , if RE has the \b and it works, can we look into the > source of re and see how its done for \b ? I had a look in the sre module (which re seems to import), but I couldn't find much. I'm not the best at analyzing source code, though. :) What is it you wa

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > hi > > > > if i have a some lines like this > > a ) "here is first string" > > b ) "here is string2" > > c ) "here is string3" > > > > When i specify i only want to print the lines that contains "string" ie > > the first line and not the others.

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > hi > > > > if i have a some lines like this > > a ) "here is first string" > > b ) "here is string2" > > c ) "here is string3" > > > > When i specify i only want to print the lines that contains "string" ie > > the first line and not the others.

Re: a string problem

2006-06-13 Thread MTD
> When i specify i only want to print the lines that contains "string" ie > the first line and not the others. If i use re module, how to compile > the expression to do this? I tried the re module and using simple > search() and everytime it gives me all the 3 lines that have "string" > in it, wher

Re: a string problem

2006-06-13 Thread micklee74
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > hi > > > > if i have a some lines like this > > a ) "here is first string" > > b ) "here is string2" > > c ) "here is string3" > > > > When i specify i only want to print the lines that contains "string" ie > > the first line and not the others.

Re: a string problem

2006-06-13 Thread John Salerno
[EMAIL PROTECTED] wrote: > hi > > if i have a some lines like this > a ) "here is first string" > b ) "here is string2" > c ) "here is string3" > > When i specify i only want to print the lines that contains "string" ie > the first line and not the others. If i use re module, how to compile > th

a string problem

2006-06-13 Thread micklee74
hi if i have a some lines like this a ) "here is first string" b ) "here is string2" c ) "here is string3" When i specify i only want to print the lines that contains "string" ie the first line and not the others. If i use re module, how to compile the expression to do this? I tried the re modul