10 if not os.path.exists(n): os.mkdir(n)
12 dst = os.path.dirname(fname)
13 name = os.path.basename(fname).split('.')[0]
15 dst2 = os.path.join(dst, name)
18 data = json.load(open(fname))
20 dst3 = os.path.join(dst2, ip['fields']['slug'])
22 for fld, val in ip['fields'].items():
23 if filter(lambda x: fld.startswith(x),
24 ['title', 'left_column', 'right_column']):
25 o = open(os.path.join(dst3, fld+".txt"),'w')
27 o.write(val.encode('utf-8'))