title: AttributeError: 'tuple' object has no attribute 'write' Error
body: <p>I keep getting this error and I have no idea what it means. I have taken measures to get rid of a tuple in my code. The program is supposed to read in a document which has a series of numbers and then sort those numbers using a bubble sort function and then print the old list and the new, sorted list onto a new file.
  My assignment is to create a new file and print the original array, from the given file, and the sorted array, sorted using a bubble sort function,  as two lines in a comma separated file.</p>
  <pre><code># reading in the document into the program
  file = open(&quot;rand_numb.csv&quot;, &quot;r&quot;)
  # creating a new file that will have the output printed on it
  newFile = (&quot;SORTED.csv&quot;, &quot;w+&quot;)
  # creating a blank list that will hold the original file's contents
  orgArr = []
  # creating the bubblesort function
  def bubblesort(arr):
      # creating a variable to represent the length of the array
      length = len(arr) 
      # traverse through all array elements 
      for i in range(length): 
          # last i elements are already in place 
          for j in range(0, length-i-1): 
              # traverse the array from 0 to length-i-1 and swap if the element found is greater than the next element
              if arr[j] &gt; arr[j+1] : 
                  arr[j], arr[j+1] = arr[j+1], arr[j]
      return arr
  # Prog4 Processing
  # using a for loop to put all of the numbers from the read-in file into a list
  listoflists = [(line.strip()).split() for line in file]
  # closing the original file
  file.close()
  # creating a variable to represent the length of the list
  listLen = len(listoflists)
  # using a for loop to have the elements in the list of lists into one list
  for num in range(0, listLen):
      orgArr.append(num)
  # using list function to change the tuple to a list
  orgArr = list(orgArr)
  # using the bubblesort function
  sortArr = bubblesort(orgArr)
  # Prog4 Output
  # outputting the two lists onto the file
  newFile.write(orgArr + &quot;\n&quot;)
  newFile.write(sortArr)
  # closing the new file
  newFile.close() ```
  </code></pre>