Graphics Reference
In-Depth Information
node = {"id": key, "count": 1, "size":
kbytes}
nodemap[key] = node
return
# similar function to add/update links
def addLink(src, tgt, kbytes):
key = src + "..." + tgt
if key in linkmap:
link = linkmap[key]
link["count"] += 1
link["size"] += kbytes
else:
link = {"src": src, "tgt": tgt, "count": 1,
"size": kbytes}
linkmap[key] = link
return
# open the file and skip the header row
with open ("emailSample.txt") as datafile:
datareader = csv.reader(datafile)
next(datareader, None)
# process each email
for row in datareader:
# size of this email
kb = int(row[4].replace("kb",""))
# create a distribution list of all the
people in this email
distlist = [];
#loop through distribution fields: from, to
and cc:
for i in range(0,3):
# split apart when the field has
multiple names
names =
row[i].replace('"','').split(';')
for name in names:
Search WWH ::




Custom Search