yaml.dump_all function

yaml.dump_all() function is used to convert the python objects into YAML documents. Each python object into separate YAML document.
if stream is specified in argument, serializes the python objects into a given stream as YAML documents.

#!/usr/bin/python
import yaml;
print(yaml.dump_all([1,2,3]));

Output:

$ python test_yaml.py
1
--- 2
--- 3
...

yaml.safe_dump

safe_dump() function is used to convert the python object into YAML document. This function produces only standard YAML tags and cannot represent an arbitrary Python object.