
Python
进击的夸克
不想再佛系的青年
展开
-
读取xml文件指定内容
def read_xml(path, tag_name='QW', attribute_name='value'): dom_tree = xml_parse(path) root_node = dom_tree.documentElement tag_list = root_node.getElementsByTagName(tag_name) details =...原创 2020-03-23 22:56:32 · 380 阅读 · 0 评论 -
PYNLPIR中文分词,生成词云图片
from collections import Counter import matplotlib.pyplot as plt import wordcloud import pynlpir with open('./paper.txt', encoding='utf-8') as text: contents = text.read() # 分词 pynlpir.open() ...原创 2020-03-22 21:52:52 · 622 阅读 · 0 评论 -
Python 递归读取某文件夹下全部指定后缀名文件
import os def all_files(path, file_type): # 生成path路径下全部file_type类型文件绝对路径列表 f_list = [] def files_list(father_path): sub_path = os.listdir(father_path) # 读取父路径下全部文件或文件夹名称 ...原创 2020-03-22 21:24:34 · 982 阅读 · 0 评论