Try this:
import maya.cmds as cmds
def renameFun ():
for i in xrange ( len ( cmds.ls (selection = True) ) + 1 ):
cmds.rename("Test_Name_%s" % i)
return True
# Python starts counting at zero so you will miss the last object without
adding a one
# range has been proven to show consistent memory drains, use xrange instead
# That’s a string, not a digit you are adding into the name
# Not sure why it would only ever rename one item, but hope this helps
# Always return at least True, according to PEP8, but if you are new to python
don’t worry about that just yet.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/52c9e4c4.08eac20a.6b33.ffffbebf%40mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.