![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
文件处理
Dre.
这个作者很懒,什么都没留下…
展开
-
python ijson处理大json文件(内存溢出解决)
code notes for explanation# before using , please "pip install ijson",# details by seeing official website: https://pypi.org/project/ijson/import ijson flag = 0 with open(train_path) as file: parser = ijson.parse(file) data =原创 2021-11-01 15:08:11 · 1900 阅读 · 0 评论 -
大的JSON文件分成多个小的JSON文件
# coding:utf-8import osimport json#F:\JR_data\new_datawith open(os.path.join('F:\JR_data\old_data', 'jr_XL.json'), 'r', encoding='utf-8') as f1: ll = [json.loads(line.strip()) for line in f1.r...原创 2019-01-14 16:30:41 · 8449 阅读 · 5 评论 -
python处理doc格式文档
(1)调用python的docx库进行读取word文档:import docxfn = r'E:\abc\test.docx'doc = docx.Document(fn)for paragraph in doc.paragraphs: print(paragraph.text)该方法自己用的时候发现,并不是能读出所有的文字,有些格式不一样的可能读取的时候就被忽略了...原创 2019-07-31 15:03:38 · 2588 阅读 · 0 评论