Hey Count Zer0 ;) Nice explanation , I never thought to explaining like this , you done a smart job :-)
On Mon, Mar 7, 2011 at 4:19 PM, Count Zer0 <[email protected]> wrote: > LML, > > Kurian is using python string formatting: > http://docs.python.org/release/2.5.2/lib/typesseq-strings.html > > In your line: > > pm.select('pCube5.f[myNum]') > > the single quotes (') designate a literal string. If you want to have > a variable inserted in there, you need to use the string formatting > syntax described in the link above. > > That is what Kurian is doing here: > > > pm.select('pCube5.f[%s]',%myNum) > > This means to take the value stored in 'myNum' (the variable right > after the last percentile (%)) and substitue it into the previous > string where there is a % 'specifier'. Pretty sure the comma is not > necessary. > > If you want to substitute 2 strings, you'd use this syntax: > > > print 'Python %s powerful, %s' % ('is', 'right?') > > Little tricky at first, but easy to grok and powerful later on. > > BTW, FYI, this is a generic Python issue, not PyMEL related. > > -jason > > > On Mar 2, 2:23 pm, Kurian O.S ™ ® <[email protected]> wrote: > > myNum = 5 > > > > for i in range(10): > > > > pm.polyCube() > > pm.move(0,0,i*2) > > > > pm.select('pCube5.f[%s]',%myNum) > > pm.delete() > > > > I hope this will work , and this the one of the best place to ask > questions > > about pymel :-) > > > > On Fri, Feb 25, 2011 at 8:22 AM, LML <[email protected]> wrote: > > > myNum = 5 > > > > > for i in range(10): > > > > > pm.polyCube() > > > pm.move(0,0,i*2) > > > > > pm.select('pCube5.f[myNum]') > > > pm.delete() > > > > -- > > --:: Kurian ::-- > > -- > http://groups.google.com/group/python_inside_maya > -- --:: Kurian ::-- -- http://groups.google.com/group/python_inside_maya
