Changes between Version 6 and Version 7 of PyYAML
- Timestamp:
- 04/23/06 04:00:24 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PyYAML
v6 v7 17 17 In particular, PyYAML can parse all examples from the specification. 18 18 The parsing algorithm is simple enough to be ported to C or other language. 19 * Unicode support including UTF-8/UTF-16 input and '''\u''' escape sequences.19 * Unicode support including UTF-8/UTF-16 input/output and '''\u''' escape sequences. 20 20 * event-based parser and emitter API (like SAX). 21 21 * high-level API for serializing and deserializing native Python objects (like DOM or pickle). … … 53 53 {{{ 54 54 #!python 55 >>> from yaml import * 56 >>> print load(""" 57 ... - foo 58 ... - bar 59 ... - baz 55 >>> import yaml 56 >>> print yaml.load(""" 57 ... name: Vorlin Laruknuzum 58 ... sex: Male 59 ... class: Priest 60 ... title: Acolyte 61 ... hp: [32, 71] 62 ... sp: [1, 13] 63 ... gold: 423 64 ... inventory: 65 ... - a Holy Book of Prayers (Words of Wisdom) 66 ... - an Azure Potion of Cure Light Wounds 67 ... - a Siver Wand of Wonder 60 68 ... """) 61 ['foo', 'bar', 'baz'] 62 >>> print dump(['foo', 'bar', 'baz']) 63 - foo 64 - bar 65 - baz 69 {'name': 'Vorlin Laruknuzum', 'gold': 423, 'title': 'Acolyte', 'hp': [32, 71], 70 'sp': [1, 13], 'sex': 'Male', 'inventory': ['a Holy Book of Prayers (Words of Wisdom)', 71 'an Azure Potion of Cure Light Wounds', 'a Siver Wand of Wonder'], 'class': 'Priest'} 72 >>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5, 'rarity': 45, 73 ... 'weight': 10, 'cost': 50000, 'flags': ['INT', 'WIS', 'SPEED', 'STEALTH']}) 74 name: The Cloak 'Colluin' 75 rarity: 45 76 flags: [INT, WIS, SPEED, STEALTH] 77 weight: 10 78 cost: 50000 79 depth: 5 66 80 }}} 67 81
