Go to: Synopsis. Return value. Python examples.
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
encodeString is undoable, NOT queryable, and NOT editable.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:
import maya.cmds as cmds # 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 = cmds.encodeString(s) print 'es=' + es es=print(\"Hello\\n\")