In [1]:
%load_ext yamlmagic

Load into _


In [2]:
%%yaml
- name: yamlmagic
- description: |
    This is a multi-line string
# this is a comment, which won't end up in the data


Out[2]:
[{'name': 'yamlmagic'}, {'description': 'This is a multi-line string\n'}]

In [3]:
print(_)


[{'name': 'yamlmagic'}, {'description': 'This is a multi-line string\n'}]

Load into x


In [4]:
%%yaml x
- name: yamlmagic
- description: |
    This is a multi-line string
# this is a comment, which won't end up in the data



In [5]:
x


Out[5]:
[{'name': 'yamlmagic'}, {'description': 'This is a multi-line string\n'}]

Don't allow !!python tags


In [6]:
%%yaml
!!python/float 0


could not determine a constructor for the tag 'tag:yaml.org,2002:python/float'
  in "<unicode string>", line 1, column 1:
    !!python/float 0
    ^