Re: [Tutor] Escaping double quotes
* w chun [EMAIL PROTECTED] [051207 22:16]: 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. hold on a second pardner! :-) what were you trying to do, provide escaped quotes? because if it was something else, like replacing the double quotes with singles, you had it correct. Yes. Escaped quotes. To be inserted in web content as escaped quotes in code for a Javascript Alert call otherwise your solution can also be done with raw strings: label.replace('','\\') 'this is \\quoted\\' label.replace('',r'\') 'this is \\quoted\\' Good tip tho' I keep forgetting about raw strings. ok, i'll stop thinking about it now. ;-) Thanks! tj cheers, -wesley -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Escaping double quotes
* Tim Johnson [EMAIL PROTECTED] [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 [EMAIL PROTECTED] http://www.alaska-internet-solutions.com -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Escaping double quotes
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' What am I missing here? thanks tim -- Tim Johnson [EMAIL PROTECTED] http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor