-
Notifications
You must be signed in to change notification settings - Fork 1
/
csvmindmao.py
28 lines (27 loc) · 962 Bytes
/
csvmindmao.py
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
28
import csv
with open('moolya.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
title=(row['title'])
string = row['subnodes']
string =map(str.strip, string.split(','))
for each in string:
print each
fp = open (title+".mm", "w")
def write_mm (string, endofline=True):
string = string.replace ("&", "&")
fp.write (string)
if endofline:
fp.write ('\n')
write_mm ('<?xml version="1.0" encoding="utf-8" standalone="no"?>')
write_mm ('<map version="0.8.1">')
write_mm ('<node TEXT="' + title + '">')
try:
for each in string:
write_mm('<node TEXT="' + each+ '">')
write_mm ('</node>')
except:
pass
write_mm ('</node>')
write_mm ('</map>')
print title+ "Mindmap Created!!"