This action will take a string and encode any character that would need to be escaped before being sent to some other command. Such characters include:double quotesnewlinestabs
Derived from mel command maya.cmds.encodeString
Example:
import pymel.core as pm
# Set the string s to: print('Hello\n');
quote = '\"'
backslash = '\\'
s = 'print(' + quote + 'Hello' + backslash + 'n' + quote + ')'
print 's=' + s
s=print("Hello\n")
es = pm.encodeString(s)
print 'es=' + es
es=print(\"Hello\\n\")