Changes between Version 6 and Version 7 of PyYAML


Ignore:
Timestamp:
04/23/06 04:00:24 (9 years ago)
Author:
xi
Comment:

Add more complex example.

Legend:

Unmodified
Added
Removed
Modified
  • PyYAML

    v6 v7  
    1717   In particular, PyYAML can parse all examples from the specification. 
    1818   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. 
    2020 * event-based parser and emitter API (like SAX). 
    2121 * high-level API for serializing and deserializing native Python objects (like DOM or pickle). 
     
    5353{{{ 
    5454#!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 
    6068... """) 
    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']}) 
     74name: The Cloak 'Colluin' 
     75rarity: 45 
     76flags: [INT, WIS, SPEED, STEALTH] 
     77weight: 10 
     78cost: 50000 
     79depth: 5 
    6680}}} 
    6781