1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #!/usr/bin/env python
#coding=utf-8
ana=[[],[]]
ordre_balises=['nivo','nom','date','text']
ana[0] ={'type': 'cont'} # Pour la balise globale banama
ana[1].append({'type': 'desc',
'nivo' : 'eleve prof',
'text' : 'Texte description No1'})
ana[1].append({'type': 'log',
'nivo' : 'eleve prof',
'nom' : 'SpeedCrunch',
'date' : '16/10/2008',
'text' : 'Presentation de SpeedCrunch'})
ana[1].append({'type': 'desc',
'nivo' : 'prof',
'text' : 'Texte description No2'})
ana[1].append({'type': 'log',
'nivo' : 'eleve',
'nom' : 'Fprime',
'date' : '28/2/2008',
'text' : 'Presentation de Fprime'})
for e in ana[1]:
for balise in ordre_balises:
if balise in e.keys():
print e[balise] |