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: 'a href=web reference underlined reference/a' Optimizing my code, I found that an essential step is: splitting on a word (in this case 'href'). I am asking

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 how

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 and

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

Splitting on a word

2005-07-13 Thread qwweeeit
Hi all, I am writing a script to visualize (and print) the web references hidden in the html files as: 'a href=web reference underlined reference/a' 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 alternative (more

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: 'a href=web reference underlined reference/a' Optimizing my code, I found that an essential step is: splitting on a word (in this case 'href'). I am asking

Re: Splitting on a word

2005-07-13 Thread Steven D'Aprano
a macho programmer you are? Is your code even working yet? If it isn't working, you shouldn't be trying to optimizing buggy code. I found that an essential step is: splitting on a word (in this case 'href'). Then just do it: py 'a href=web reference underlined reference/a'.split('href

Re: Splitting on a word

2005-07-13 Thread Joe
# string s simulating an html file s='ffy: ytrty a href=www.python.orgpython/a fyt A HREF=wwwxwx/A 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