Re: Splitting on a word

2005-07-14 Thread qwweeeit
Hi Bernhard, firstly you must excuse my English ("angry" is a little ...strong, but my vocabulary is limited). I hope that the experts keep on helping us newbie. Also if I am a newbie (in Python), I disagree with you: my solution (with the help of Joe) answers to the problem of splitting a string u

Re: Splitting on a word

2005-07-14 Thread Bernhard Holzmayer
[EMAIL PROTECTED] wrote: > Bernard... don't get angry, but I prefer the solution of Joe. Oh. If I got angry in such a case, I would have stopped responding to such posts long ago You know the background... and you'll have to bear the consequences. ;-) > ... > for me "pythonic" means simple

Re: Splitting on a word

2005-07-14 Thread qwweeeit
Hi all, thanks for your contributions. To Robert Kern I can replay that I know BeautifulSoap, but mine wanted to be a "generalization" (only incidentally used in a web parsing application). The fact is that, beeing a "macho newbie" programmer (the "macho" is from Steven D'Aprano), I wanted to show

Re: Splitting on a word

2005-07-14 Thread Bernhard Holzmayer
[EMAIL PROTECTED] wrote: > Hi all, > I am writing a script to visualize (and print) > the web references hidden in the html files as: > ' underlined reference' > Optimizing my code, I found that an essential step is: > splitting on a word (in this case 'href'). > > I am asking if there is some al

Re: Splitting on a word

2005-07-13 Thread Joe
# string s simulating an html file s='ffy: ytrty python fyt wx dtrtf' p=re.compile(r'\bhref\b',re.I) list=p.split(s) #< gets you your final list. good luck, Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting on a word

2005-07-13 Thread Steven D'Aprano
On Wed, 13 Jul 2005 06:19:54 -0700, qwweeeit wrote: > Hi all, > I am writing a script to visualize (and print) > the web references hidden in the html files as: > ' underlined reference' > Optimizing my code, [red rag to bull] Because it was too slow? Or just to prove what a macho programmer you

Re: Splitting on a word

2005-07-13 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi all, > I am writing a script to visualize (and print) > the web references hidden in the html files as: > ' underlined reference' > Optimizing my code, I found that an essential step is: > splitting on a word (in this case 'href'). > > I am asking if there is some alt