Go to: Synopsis. Return value. Python examples.


encodeString( string )

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:

Return value


Python examples

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

es = cmds.encodeString(s)
print 'es=' + es