galactic.io.data.yaml#
galactic.io.data.yaml module
Defines the data reader for YAML files.
Class
YAMLDataReaderfor reading.yamlor.ymlfiles
- class YAMLDataReader#
Bases:
objectYAML Data reader.
Example
>>> from pprint import pprint >>> from galactic.io.data.yaml import YAMLDataReader >>> reader = YAMLDataReader() >>> import io >>> text = '''# This is a YAML document. ... - firstname: Évariste ... name: Galois ... - firstname: Rudolf ... name: Wille ... ''' >>> dataset = reader.read(io.StringIO(text)) >>> pprint(dataset) [{'firstname': 'Évariste', 'name': 'Galois'}, {'firstname': 'Rudolf', 'name': 'Wille'}]
- read(data_file)#
Read a YAML data file.