title: Nester.py: AttributeError: 'str' object has no value 'write'
body: <p>Following the book, chapter four on persistence in Python, they ask us to amend the function of a module called "print_lol" inside of "nester".</p>
  
  <p>Here's my code.</p>
  
  <pre><code>import sys 
  def print_lol(the_list, indent=False, level=0, fh=sys.stdout):
  
      for each_item in the_list:
          if isinstance(each_item, list):
              print_lol(each_item, indent, level+1, fh) 
          else:
              if indent:
                  for tab_stop in range(level):
                      print("\t", end='', file=fh)
              else:
                  print(each_item, file=fh)
  </code></pre>
  
  <p>Here's the testing code.</p>
  
  <pre><code>import nester3
  
  pl = nester3.print_lol
  
  cat = ['death', [3, 4, 5, ['life']]]
  
  pl(cat, indent=True, fh='amazing.txt')
  </code></pre>
  
  <p>What happens when I attempt to actually call this code is this statement:</p>
  
  <pre><code>File "tester.py", line 7, in &lt;module&gt;
      pl(cat, indent=True, fh='amazing.txt')
  File "/home/ehl/Python/nester/nester3.py", line 39, in print_lol
      print_lol(each_item, indent, level+1, fh) 
  File "/home/ehl/Python/nester/nester3.py", line 43, in print_lol
      print("\t", end='', file=fh)
  </code></pre>
  
  <p>AttributeError: 'str' object has no attribute 'write'</p>
  
  <p>I don't understand how I could possibly add the "write" attribute, any help would be appreciated.</p>