title: How to format a MEL expression string for the expression command in Python?
body: <p>I am having a problem when creating a Maya MEL expression with a python script. I need to be able to format the expression based on the values entered into certain GUI components but when I try format the expression that contains an "if statement" there is some conflicting. Take a look:</p>
  
  <pre><code>revol_int = self.revol_int.value()
  
  revolExpression = pm.expression(o=rigRevol, s='if (frame%8 == 0) {rz = (frame//{0}) * ((360/{1}.000)/2.000);}'.format(interv_int, revol_int))
  </code></pre>
  
  <p>The expression works when entered manually but when done by formatting through the script I get an <strong>KeyError</strong> due to the "{}" that house the if statements block of code. So I tried the other method of formatting:</p>
  
  <pre><code>revol_int = self.revol_int.value()
  
  revolExpression = pm.expression(o=rigRevol, n='olr_revolutions_expression', s='if (frame%8 == 0) {rz = (frame//%s) * ((360/%s.000)/2.000);}' % (interv_int, revol_int))
  </code></pre>
  
  <p>But in this case I get a <strong># ValueError: unsupported format character ' ' (0x20) at index 11</strong>. I am quite uncertain where to go from here. Any suggestions would be greatly appreciated.</p>