title: Open a JS file and edit a line with Python
body: <p>I'm trying to modify a specific line in a js file using python.</p>
  
  <p>Here's the js file :</p>
  
  <pre><code>...
  hide: [""]
  ...
  </code></pre>
  
  <p>Here's my python code :</p>
  
  <pre><code>with open('./config.js','r') as f:
     lines = f.readlines()
  
  with open('./config.js','w') as f:
     for line in lines:
         line = line.replace('hide', 'something')
         f.write(line)
  </code></pre>
  
  <p>So it works but this is not what I want to do.</p>
  
  <p>I want to write 'something' between the brackets and not replace 'hide'.</p>
  
  <p>So I don't know how to do it: Do I have to replace the whole line or can I just add a word between the brackets?</p>
  
  <p>Thanks</p>