本文整理汇总了Python中TreeNode.TreeNode.return_json方法的典型用法代码示例。如果您正苦于以下问题:Python TreeNode.return_json方法的具体用法?Python TreeNode.return_json怎么用?Python TreeNode.return_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode.TreeNode
的用法示例。
在下文中一共展示了TreeNode.return_json方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from TreeNode import TreeNode [as 别名]
# 或者: from TreeNode.TreeNode import return_json [as 别名]
for item in file_data2:
fileCount = fileCount + 1
nodes2.append(item)
print "number of reddits in the new dictionary %d " % fileCount
nodecount = 0
for node in nodes2:
if node.subscribers < 1000:
nodecount = nodecount+1
if node.subscribers is None:
print "There is a subreddit with no subscribers"
print "total nodes with less than 1000 subscribers % d " % nodecount
count = 0
reddit500 = []
for node in nodes2:
reddit500.append(node)
count = count + 1
print count
for node in reddit500:
if node.parent is None:
reddit.add_child(node)
# dump the data into a json file to create viz#
json_output = open('REDDITS4.json', 'wb')
a = "var viz_data = " + json.dumps(reddit.return_json()) + ";"
json_output.write(a)
json_output.close()