bundles / astropy 7.0.1 / astropy / io / fits / header / Header / tofile
function
astropy.io.fits.header:Header.tofile
source: /astropy/io/fits/header.py:711
Signature
def tofile(self, fileobj, sep = '', endcard = True, padding = True, overwrite = False)Summary
Writes the header to file or file-like object.
Extended Summary
By default this writes the header exactly as it would be written to a FITS file, with the END card included and padding to the next multiple of 2880 bytes. However, aspects of this may be controlled.
Parameters
fileobj: path-like or file-like, optionalEither the pathname of a file, or an open file handle or file-like object.
sep: str, optionalThe character or string with which to separate cards. By default there is no separator, but one could use
'\\n', for example, to separate each card with a new lineendcard: bool, optionalIf True (default) adds the END card to the end of the header string
padding: bool, optionalIf True (default) pads the string with spaces out to the next multiple of 2880 characters
overwrite: bool, optionalIf
True, overwrite the output file if it exists. Raises anOSErrorifFalseand the output file exists. Default isFalse.
Aliases
astropy.io.fits.Header.tofile