Lawrence D'Oliveiro wrote: > Another useful function is this: > > def JSString(Str) : > """returns a JavaScript string literal that evaluates to Str....
You can do this more simply:
_map = {"\\" : "\\\\", "\"" : "\\\"", "\t" : "\\t", "\n" : "\\n"}
def JSString(Str) :
mapped = [_map.get(Ch, Ch) for Ch in Str]
return "\"" + "".join(mapped) + "\""
--
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
