parameters: (self, row, col, *args)
docstring: Write data to a worksheet cell by calling the appropriate write_*()
          method based on the type of data being passed.
  
          Args:
              row:   The cell row (zero indexed).
              col:   The cell column (zero indexed).
              *args: Args to pass to sub functions.
  
          Returns:
               0:    Success.
              -1:    Row or column is out of worksheet bounds.
              other: Return value of called method.
docstring_summary: Write data to a worksheet cell by calling the appropriate write_*()
          method based on the type of data being passed.
docstring_tokens: Write data to a worksheet cell by calling the appropriate write_ * () method based on the type of data being passed .
function: def write(self, row, col, *args):
          """
          Write data to a worksheet cell by calling the appropriate write_*()
          method based on the type of data being passed.
  
          Args:
              row:   The cell row (zero indexed).
              col:   The cell column (zero indexed).
              *args: Args to pass to sub functions.
  
          Returns:
               0:    Success.
              -1:    Row or column is out of worksheet bounds.
              other: Return value of called method.
  
          """
          # Check the number of args passed.
          if not len(args):
              raise TypeError("write() takes at least 4 arguments (3 given)")
  
          # The first arg should be the token for all write calls.
          token = args[0]
  
          # Write None as a blank cell.
          if token is None:
              return self.write_blank(row, col, *args)
  
          # Write boolean types.
          if isinstance(token, bool):
              return self.write_boolean(row, col, *args)
  
          # Write datetime objects.
          if supported_datetime(token):
              return self.write_datetime(row, col, *args)
  
          # Write number types.
          if isinstance(token, num_types):
              return self.write_number(row, col, *args)
  
          # Write string types.
          if isinstance(token, str_types):
              # Map the data to the appropriate write_*() method.
              if token == '':
                  return self.write_blank(row, col, *args)
  
              elif self.strings_to_formulas and token.startswith('='):
                  return self.write_formula(row, col, *args)
  
              elif self.strings_to_urls and re.match('(ftp|http)s?://', token):
                  return self.write_url(row, col, *args)
  
              elif self.strings_to_urls and re.match('mailto:', token):
                  return self.write_url(row, col, *args)
  
              elif self.strings_to_urls and re.match('(in|ex)ternal:', token):
                  return self.write_url(row, col, *args)
  
              elif self.strings_to_numbers:
                  try:
                      f = float(token)
                      if (self.nan_inf_to_errors or
                              (not self._isnan(f) and not self._isinf(f))):
                          return self.write_number(row, col, f, *args[1:])
                  except ValueError:
                      # Not a number, write as a string.
                      pass
  
                  return self.write_string(row, col, *args)
  
              else:
                  # We have a plain string.
                  return self.write_string(row, col, *args)
  
          # We haven't matched a supported type. Try float.
          try:
              f = float(token)
              return self.write_number(row, col, f, *args[1:])
          except ValueError:
              pass
          except TypeError:
              raise TypeError("Unsupported type %s in write()" % type(token))
  
          # Finally try string.
          try:
              str(token)
              return self.write_string(row, col, *args)
          except ValueError:
              raise TypeError("Unsupported type %s in write()" % type(token))
function_tokens: def write ( self , row , col , * args ) : # Check the number of args passed. if not len ( args ) : raise TypeError ( "write() takes at least 4 arguments (3 given)" ) # The first arg should be the token for all write calls. token = args [ 0 ] # Write None as a blank cell. if token is None : return self . write_blank ( row , col , * args ) # Write boolean types. if isinstance ( token , bool ) : return self . write_boolean ( row , col , * args ) # Write datetime objects. if supported_datetime ( token ) : return self . write_datetime ( row , col , * args ) # Write number types. if isinstance ( token , num_types ) : return self . write_number ( row , col , * args ) # Write string types. if isinstance ( token , str_types ) : # Map the data to the appropriate write_*() method. if token == '' : return self . write_blank ( row , col , * args ) elif self . strings_to_formulas and token . startswith ( '=' ) : return self . write_formula ( row , col , * args ) elif self . strings_to_urls and re . match ( '(ftp|http)s?://' , token ) : return self . write_url ( row , col , * args ) elif self . strings_to_urls and re . match ( 'mailto:' , token ) : return self . write_url ( row , col , * args ) elif self . strings_to_urls and re . match ( '(in|ex)ternal:' , token ) : return self . write_url ( row , col , * args ) elif self . strings_to_numbers : try : f = float ( token ) if ( self . nan_inf_to_errors or ( not self . _isnan ( f ) and not self . _isinf ( f ) ) ) : return self . write_number ( row , col , f , * args [ 1 : ] ) except ValueError : # Not a number, write as a string. pass return self . write_string ( row , col , * args ) else : # We have a plain string. return self . write_string ( row , col , * args ) # We haven't matched a supported type. Try float. try : f = float ( token ) return self . write_number ( row , col , f , * args [ 1 : ] ) except ValueError : pass except TypeError : raise TypeError ( "Unsupported type %s in write()" % type ( token ) ) # Finally try string. try : str ( token ) return self . write_string ( row , col , * args ) except ValueError : raise TypeError ( "Unsupported type %s in write()" % type ( token ) )