[Tutor] Escaping double quotes

Tim Johnson tim at johnsons-web.com
Thu Dec 8 02:50:46 CET 2005


* Tim Johnson <tim at johnsons-web.com> [051207 15:56]:
> I must be having a Senior Moment here, but the following
> baffles me:
> >>> label = 'this is "quoted"'
> >>> label.replace('"','\"')
> 'this is "quoted"'
> ## This works
> >>> label.replace('"','\'')
> "this is 'quoted'"
 
  <blush>
  What I should have been using is
  label.replace('"','\\"')
  :-) Nevermind.
  tj
  
> What am I missing here?
> thanks
> tim
> 
> -- 
> Tim Johnson <tim at johnsons-web.com>
>       http://www.alaska-internet-solutions.com

-- 
Tim Johnson <tim at johnsons-web.com>
      http://www.alaska-internet-solutions.com


More information about the Tutor mailing list