File: strip_cookbook_data.py

package info (click to toggle)
python-markdown2 2.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,104 kB
  • sloc: python: 5,416; perl: 1,493; php: 865; makefile: 34
file content (22 lines) | stat: -rw-r--r-- 537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

from os.path import *
from pprint import pformat

def doit():
    recipes_path = expanduser("recipes.pprint")
    recipe_dicts = eval(open(recipes_path).read())
    for r in recipe_dicts:
        for key in r.keys():
            if key not in ('desc', 'comments'):
                del r[key]
        for c in r['comments']:
            for key in c.keys():
                if key not in ('comment', 'title'):
                    del c[key]

    f = open("stripped.pprint", 'w')
    f.write(pformat(recipe_dicts))
    f.close()


doit()