I am try to write a code that turn codes to html file
I do it like this,(It is take out from example code form sourceforge):

re_lead=re.compile(r"[\f\t]")
re_space=re.compile(r"[ ]{2,}")
src = re_lead.sub(r"&nbsp&nbsp&nbsp&nbsp ",src)         
src = re_lead.sub(r"&nbsp&nbsp&nbsp&nbsp ",src)         

  src is the code string!
  as you can see, I repeat the search many time to replace two or more \t 
before the code line.
  but, if somebody use space, some time may be up to 8 or 9 times before a 
line,it 
would be stupid to repeat 8 time of search to replace them!
  It's there a method that can replace  all spaces with "&nbsp" just at one 
search 
action, and pass the single space between words!
  I am new to re module,please help! thanks! 

[EMAIL PROTECTED]
          2005-11-06

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to