title: Difference between io.StringIO and a string variable in python
body: <p>I am new to python. </p>
  
  <p>Can anybody explain what's the difference between a string variable and  io.StringIO . In both we can save character. </p>
  
  <p>e.g </p>
  
  <p>String variable</p>
  
  <pre><code>k= 'RAVI'
  </code></pre>
  
  <p>io.stringIO</p>
  
  <pre><code>string_out = io.StringIO()
  string_out.write('A sample string which we have to send to server as string data.')
  string_out.getvalue()
  </code></pre>
  
  <p>If we print k or string_out.getvalue() both will print  the text</p>
  
  <pre><code>print(k)
  print(string_out.getvalue())
  </code></pre>