title: inserting character in file , jython
body: <p>I have written a simple program where to read the first 4 characters and get the integer of it and read those many character and write xxxx after it . Although the program is working the only issues instead of inserting the character ,  its replacing. </p>
  
  <pre><code>file = open('C:/40_60.txt','r+')
  i=0
  while 1:
      char = int(file.read(4))
      if not char: break
      print file.read(char)
      file.write('xxxx')
  
  print 'done'
  file.close()
  </code></pre>
  
  <p>I am having issue with writing data . 
  considering this is my sample data 
  00146456135451354500107589030015001555854640020
  and expected output is 
  001464561354513545xxxx00107589030015001555854640020</p>
  
  <p>but actually my above program is giving me this output</p>
  
  <p>001464561354513545xxxx7589030015001555854640020
  ie. xxxx overwrites 0010. </p>
  
  <p>Please suggest. </p>