#NEWLINE# def tabledump( filename , datafile = None , cdfile = None , hfile = None , ext = 1 , clobber = False ) : #NEWLINE# #INDENT# '\n    Dump a table HDU to a file in ASCII format.  The table may be\n    dumped in three separate files, one containing column definitions,\n    one containing header parameters, and one for table data.\n\n    Parameters\n    ----------\n    filename : file path, file object or file-like object\n        Input fits file.\n\n    datafile : file path, file object or file-like object, optional\n        Output data file.  The default is the root name of the input\n        fits file appended with an underscore, followed by the\n        extension number (ext), followed by the extension ``.txt``.\n\n    cdfile : file path, file object or file-like object, optional\n        Output column definitions file.  The default is `None`,\n        no column definitions output is produced.\n\n    hfile : file path, file object or file-like object, optional\n        Output header parameters file.  The default is `None`,\n        no header parameters output is produced.\n\n    ext : int\n        The number of the extension containing the table HDU to be\n        dumped.\n\n    clobber : bool\n        Overwrite the output files if they exist.\n\n    Notes\n    -----\n    The primary use for the `tabledump` function is to allow editing in a\n    standard text editor of the table data and parameters.  The\n    ``tcreate`` function can be used to reassemble the table from the\n    three ASCII files.\n    ' #NEWLINE# ( mode , closed ) = _get_file_mode ( filename , default = 'readonly' ) #NEWLINE# f = fitsopen ( filename , mode = mode ) #NEWLINE# if ( not datafile ) : #NEWLINE# #INDENT# ( root , tail ) = os . path . splitext ( f . _HDUList__file . name ) #NEWLINE# datafile = ( ( ( root + '_' ) + repr ( ext ) ) + '.txt' ) #NEWLINE# #UNINDENT# f [ ext ] . dump ( datafile , cdfile , hfile , clobber ) #NEWLINE# if closed : #NEWLINE# #INDENT# f . close ( )