des trucs genre [mail], parce que Python intègre un parser de fichiers de conf, mais il a besoin de sections (comme les fichiers ini windows) sinon il pète.
brandtance a écrit :
En fait c'est un simple fichier texte auquel on a changé l'extension .txt en .cfg.
|
Bah un coup de split + [0] et baste, genre:
Code :
keys = set([re.split(r'\s*=\s*', line)[0] for line in open("tonfichier.cfg" )])
|
Et là paf t'as un set() de tes clés, tu fais pareil avec l'autre fichier et après tu peux utiliser toutes les opérations sur sets (genre difference, issuperset, issubset, intersection, ...)
Message édité par masklinn le 28-04-2009 à 15:12:41
---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?