浏览代码

Output the statistics for .csv output

Xi Ruoyao 5 年之前
父节点
当前提交
9782391717
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      wordfreq.py

+ 7 - 0
wordfreq.py

@@ -79,6 +79,13 @@ def main():
     if args.debug:
         print(c)
 
+    # recognize .csv output and skip wordcloud
+    if args.output[-4:] == '.csv':
+        with open(args.output, mode="w") as ofile:
+            for i in c:
+                ofile.write(i + ',' + str(c[i]) + '\n')
+        return
+
     mask = None
     if not args.mask is None:
         from PIL import Image