title: assign output of print to a variable in python
body: <p>i want to know how to assign the output of print to a variable. </p>
  
  <p>so if </p>
  
  <pre><code>mystring = "a=\'12\'"
  </code></pre>
  
  <p>then </p>
  
  <pre><code>print mystring 
  a=12
  </code></pre>
  
  <p>and i want to pass this  like  **kwargs,</p>
  
  <pre><code>test(mystring)
  </code></pre>
  
  <p>how can i do this?</p>
  
  <p>for more of an explanation: i have a list of strings i got from a a comment line of a data file. it looks like this:</p>
  
  <pre><code>"a='0.015in' lPrime='0.292' offX='45um' offY='75um' sPrime='0.393' twistLength='0'",
   "a='0.015in' lPrime='0.292' offX='60um' offY='75um' sPrime='0.393' twistLength='0'",
   "a='0.015in' lPrime='0.292' offX='75um' offY='75um' sPrime='0.393' twistLength='0'",
   '']
  </code></pre>
  
  <p>i want to put the values into some structure so i can plot the various things versus any variabls so the list is a legend basically, and i want to plot functions of the traces versus variables given in teh legend.</p>
  
  <p>so if for each entry i have a trace, then i may want to plot max(trace) vs offX for a series of a values.</p>
  
  <p>and my first idea was to pass the strings as **kwargs to a function which would produce a matrix of corresponding data.</p>