title: I need to import a txt file as a list for a specific function
body: <p>I am trying to save and load calibration data for my sensor. I was able to read the calibration data and save it to a text file. When looking at the text file there are 22 numbers separated by comas all in a set of square brackets. </p>
  
  <p>I need to import that text file in a way the set_calibration function will read it. </p>
  
  <p>Here is the set calibration function.</p>
  
  <pre><code>def set_calibration(self, data):
      """Set the sensor's calibration data using a list of 22 bytes that
      represent the sensor offsets and calibration data.  This data should be
      a value that was previously retrieved with get_calibration (and then
      perhaps persisted to disk or other location until needed again).
      """
      # Check that 22 bytes were passed in with calibration data.
      if data is None or len(data) != 22:
          raise ValueError('Expected a list of 22 bytes for calibration data.')
      # Switch to configuration mode, as mentioned in section 3.10.4 of datasheet.
      self._config_mode()
      # Set the 22 bytes of calibration data.
      self._write_bytes(ACCEL_OFFSET_X_LSB_ADDR, data)
      # Go back to normal operation mode.
      self._operation_mode()
  </code></pre>
  
  <p>Problem is, this is my first time using python and I have very very little coding experience. I tried this:</p>
  
  <pre><code>calfile=open("calibrate.txt","r")
  caldata=calfile.readlines()
  calfile.close()
  </code></pre>
  
  <p>After that caldata will print as "['[242, 255, 0, 0, 27, 0, 65, 2, 139, 3, 174, 255, 255, 255, 255, 255, 0, 0, 232, 3, 102, 3]']", but the set_calibration function returns the "expected a list of 22 bytes for calibration data." error. when run as</p>
  
  <pre><code>bno.set_calibration(caldata)
  </code></pre>
  
  <p>I'm not sure how much this will help, but the sensor is an Adafruit BNO055 and I am running it using a Raspberry Pi. I have a strong feeling I am misusing and/or abusing the read function, but, like i said, i am very new to this.</p>