Create yaml file where each of these keys ['ABAROUTINGNUMBER', 'CREDITCARD', 'CRYPTO',…
- User
Create yaml file where each of these keys ['ABA_ROUTING_NUMBER', 'CREDIT_CARD', 'CRYPTO', 'DATE_TIME', 'EMAIL_ADDRESS', 'ES_NIF', 'IP_ADDRESS', 'IT_DRIVER_LICENSE', 'IT_FISCAL_CODE', 'IT_IDENTITY_CARD', 'IT_PASSPORT', 'IT_VAT_CODE', 'MEDICAL_LICENSE', 'PHONE_NUMBER', 'SG_NRIC_FIN', 'UK_NHS', 'URL', 'US_BANK_NUMBER', 'US_DRIVER_LICENSE', 'US_ITIN', 'US_PASSPORT', 'US_SSN', 'AU_ABN', 'AU_ACN', 'AU_TFN', 'AU_MEDICARE', 'IN_PAN'] will have value "reg_exp" and those keys ["PERSON", "ADDRESS", "ORGANISATION"] will "neural_network" value
- Assistant
ABA_ROUTING_NUMBER: reg_exp CREDIT_CARD: reg_exp CRYPTO: reg_exp DATE_TIME: reg_exp EMAIL_ADDRESS: reg_exp ES_NIF: reg_exp IP_ADDRESS: reg_exp IT_DRIVER_LICENSE: reg_exp IT_FISCAL_CODE: reg_exp IT_IDENTITY_CARD: reg_exp IT_PASSPORT: reg_exp IT_VAT_CODE: reg_exp MEDICAL_LICENSE: reg_exp PHONE_NUMBER: reg_exp SG_NRIC_FIN: reg_exp UK_NHS: reg_exp URL: reg_exp US_BANK_NUMBER: reg_exp US_DRIVER_LICENSE: reg_exp US_ITIN: reg_exp US_PASSPORT: reg_exp US_SSN: reg_exp AU_ABN: reg_exp AU_ACN: reg_exp AU_TFN: reg_exp AU_MEDICARE: reg_exp PERSON: neural_network ADDRESS: neural_network ORGANISATION: neural_network IN_PAN: reg_exp - User
How to read this yaml file using python
- Assistant
To read the YAML file using Python, you can use the
pyyamlpackage. Here's an example of how to read the YAML file and access its values:import yaml # Open the YAML file with open('file.yaml', 'r') as file: # Parse the YAML data data = yaml.safe_load(file) # Access the values regexp_values = [key for key, value in data.items() if value == 'reg_exp'] neural_network_values = [key for key, value in data.items() if value == 'neural_network']In the above code, replace
'file.yaml'with the path to your YAML file. After parsing the YAML data usingyaml.safe_load(), you can access the values based on their keys. Theregexp_valueslist will contain keys with the value'reg_exp', and theneural_network_valueslist will contain keys with the value'neural_network'.