This is a simple case but it will get much longer and I'd rather not have to have a big list of variables.
"""
import maya.cmds as cmds
import string
fingers = ["index", "middle", "ring", "pinky", "thumb"]
allTheLetters = string.uppercase
for finger in fingers:
for letter in range(4):
"%s%s" % (finger, allTheLetters[letter]) = "%s%s_" % (finger, allTheLetters[letter])
"""
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5320105A.4020501%40gmail.com.--
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 python_inside_maya+unsub...@googlegroups.com.
I have seen this similar question come up a few times via stackoverflow. Its is basically someone wanting to make "dynamically named variables". And it usually results in the same answer:
There are usually better ways to solve the problem, and a dict is commonly one of them. You pretty much never want to actually generate dynamic variable that you have no reference to other than through globals()
A dict is a good way to build key/value pairs on the fly.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODYr5bsuNuRBe3qOhmJAfSmqfisS1xd4LiAy%3DUZWpYbcA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0HU_oXkDqs%2BYKU9H%2Ba%3DPgE-xkbU-1cQnEN0OK8EH70GQ%40mail.gmail.com.