Skip to content

Instantly share code, notes, and snippets.

@PeterDrakeNichols
Last active October 31, 2017 10:54
Show Gist options
  • Save PeterDrakeNichols/f7ec0db3e00bd1a7b8ae27348fb4f47d to your computer and use it in GitHub Desktop.
Save PeterDrakeNichols/f7ec0db3e00bd1a7b8ae27348fb4f47d to your computer and use it in GitHub Desktop.
esteban py examples
for i in range(10):
for j in range(10):
coord = (i,0,j)
print coord
plane = mc.polyPlane()
mc.xform(plane, t = coord, ws=1)
mc.aimConstraint('locator1', plane)
# normal for loop iterating over string
for x in 'esteban':
print x
#getting index
for x in range(len('esteban')):
print x
#getting both index and value
for i, letter in enumerate('esteban'):
print i
print letter
#nested for loop iterating over list of strings
for word in ['esteban', 'needs', 'to', 'restaban']:
print word
for letter in word:
print letter
#continue statement
word = 'sweetestCream'
for letter in word:
if letter is 'e':
continue
print letter
#break statement
word = 'sweetestCream'
for letter in word:
if letter is 'e':
break
print letter
sel = mc.ls(sl=1)
for obj in sel:
newName = 'face_' + obj
mc.rename(obj, newName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment