title: AttributeError: 'list' object has no attribute 'write'
body: <p>i have a txt file and code like this :</p>
  <p>------ this is the content inside data_user.txt ------</p>
  <pre><code>name  : aldo
  email : alfo@gmail
  
  name  : gume
  email : gume@mail
  
  name  : noname
  email : noname@mail
  </code></pre>
  <p>------ this is my code -----</p>
  <pre><code>def modifytext2():
      file1 = open('data_user1.txt' , 'r') #read from txt file
      f = file1.readlines()
      g = [i.replace('@','---') for i in f]
      
      print(g)
      file1.close()
  
  modifytext2()
  </code></pre>
  <p>when i run the code and the output will be, this successfull to change '@' become '---' :</p>
  <pre><code>['name  : aldo\n', 'email : alfo---gmail\n', '\n', 'name  : gume\n', 'email : gume---mail\n', '\n', 'name  : noname\n', 'email : noname---mail\n', '\n']
  </code></pre>
  <p>now i want to print the output line by line, similar with the txt file content, then i change my code become :</p>
  <pre><code>def modifytext2():
      file1 = open('data_user1.txt' , 'r') #read from txt file
      f = file1.readlines()
      g = [i.replace('@','---') for i in f]
      for x in g:
          g.write('\n')
      print(x)
      file1.close()
  
  modifytext2()
  </code></pre>
  <p>after i change the code, it showing :</p>
  <pre><code>Traceback (most recent call last):
    File &quot;c:\Users\NBUSER\Documents\ARTOFWAR\PITON\02-piton\copycontent.py&quot;, line 43, in &lt;module&gt;
      modifytext2()
    File &quot;c:\Users\NBUSER\Documents\ARTOFWAR\PITON\02-piton\copycontent.py&quot;, line 38, in modifytext2      
      g.write('\n')
  AttributeError: 'list' object has no attribute 'write'
  </code></pre>