Re: String search

2009-02-27 Thread odeits
On Feb 27, 2:17 am, "Gabriel Genellina" wrote: > En Fri, 27 Feb 2009 07:33:44 -0200, pranav escribió: > > > Greeting fellow pycoders, > > > I have a script that browses large codes and replaces certain text > > with some other text. Of lately i observed an issue.Some of the > > original text were

Re: String search

2009-02-27 Thread Gabriel Genellina
En Fri, 27 Feb 2009 07:33:44 -0200, pranav escribió: Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this

Re: String search

2009-02-27 Thread Bruno Desthuilliers
pranav a écrit : Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this code and suggests replacement to this

String search

2009-02-27 Thread pranav
Greeting fellow pycoders, I have a script that browses large codes and replaces certain text with some other text. Of lately i observed an issue.Some of the original text were like ,N'#attributes.SOFTPREREQ#' My module does scan this code and suggests replacement to this code. But when i u

Re: string search and modification

2006-09-07 Thread John Machin
Jim Britain wrote: > > Final integration: > > def identifyHost(self): > for line in self.fileContents: > if re.search("throttling", line.lower()): > p=r'\[((\d{1,3}\.){3}\d{1,3})\]' > ip=re.search(p,line) A prudent pessimist might test

Re: string search and modification

2006-09-07 Thread Jim Britain
On 06 Sep 2006 13:23:43 -0700, Paul Rubin wrote: >Jim Britain <[EMAIL PROTECTED]> writes: >> I would like to match [123.123.123.123] (including the qualifying >> brackets), but be able to simply return the contents, without the >> brackets. > > > >>> p=r'\[((\d{1,3}\.){3

Re: string search and modification

2006-09-06 Thread Paul Rubin
Jim Britain <[EMAIL PROTECTED]> writes: > I would like to match [123.123.123.123] (including the qualifying > brackets), but be able to simply return the contents, without the > brackets. >>> p=r'\[((\d{1,3}\.){3}\d{1,3})\]' >>> m = 'dsl-kk-dynamic-013.38.22.125.touchtelindia.net [125.22.38.13]

string search and modification

2006-09-06 Thread Jim Britain
I know absolutely nothing about Python. My background is shell scripts assembly language and C programming. Currently I work network support. This is a portion of a Python script written by aaronsinclair. the full script can be found at: http://forums.ev1servers.net/printthread.php?t=50435&pa

Re: simple string search and replace

2006-03-25 Thread Steve Holden
Kun wrote: > hey guys, here's my code, > > senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend > <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS > (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] > print senders > parsed_senders = [] > sender = "" > for i

Re: simple string search and replace

2006-03-25 Thread bearophileHUGS
Generally, to remove a substring (like ">") from a string you can use the replace method (that returns a new string): >>> s = "...anon.wharton.com>..." >>> s.replace(">", "") '...anon.wharton.com...' You can use it with something like: print [s.replace(">", "") for s in parsed_senders] or you ca

simple string search and replace

2006-03-25 Thread Kun
hey guys, here's my code, senders = [('460 (BODY[HEADER.FIELDS (FROM)] {46}', 'From: Friend <[EMAIL PROTECTED]>\r\n\r\n'), ')', ('462 (BODY[HEADER.FIELDS (FROM)] {37}', 'From: Kun <[EMAIL PROTECTED]>\r\n\r\n'), ')'] print senders parsed_senders = [] sender = "" for item in senders: if isinst