| AHELP for CIAO 4.4 | key_exists |
Context: crates |
Synopsis
Determine if the keyword exists in the crate.
Syntax
key_exists(crate, name)
Description
- crate - input crate
- name - the keyword to check
The key_exists command returns True if the keyword exists and False if not. The comparison is case-insensitive.
The get_key_names() routine ("ahelp get_key_names") can be used to find the names of all the keywords in a Crate.
Example
>>> cr = read_file("evt2.fits")
>>> key_exists(cr, "DETNAM")
True
>>> key_exists(cr, "detnam")
TrueNote that the check is case-insensitive.
Changes in CIAO 4.4
The return value is now True or False rather than 1 or 0.
Bugs
See the bug pages on the CIAO website for an up-to-date listing of known bugs.
Refer to the CIAO bug pages for an up-to-date listing of known issues.
See Also
- contrib
- add_keyval
- crates
- add_key, col_exists, cratekey, delete_key, get_key, get_key_names, get_keyval, is_pha, is_rmf, is_virtual, set_keyval

![[CIAO Logo]](../imgs/ciao_logo_navbar.gif)