[Tutor] raw string - solution to open_new() problem

Tom Cloyd tomcloyd at bestmindhealth.com
Mon Aug 8 12:12:38 CEST 2005


Ewald Ertl's reply to Don Parris's question about "r" operator gave me the  
idea of trying that out to solve my problem with file name scrambling when  
trying to use webbrowser.open_new() to open a file on my computer in a  
browser. It worked!

So, thie

webbrowser.open_new("file://C:\__Library\folders\02394 Yale Style  
Manual\02394 Yale_Style_Manual.htm")

does not work, but this

webbrowser.open_new(r"file://C:\__Library\folders\02394 Yale Style  
Manual\02394 Yale_Style_Manual.htm")

does.

Thank you Ewald, for triggering the solution in my mind!

Now, if anyone can explain why webbrowser.open_new() does the character  
substitution thing it was doing (and thus becoming unable to locate the  
file in question), I'm eager to hear it.

Meanwhile, I can go ahead with my program.

-- t.

======================================================
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< BestMindHealth.com / tc at bestmindhealth.com >>
======================================================

Using Opera's revolutionary e-mail client (program):  
http://www.opera.com/mail/


More information about the Tutor mailing list