摘要: python-docx库 写入docx时中文不适配问题,中文异常问题解决办法。 通过以下方法可以成功将正文修改为宋体字体。这个是全文设置。 from docx.oxml.ns import qn doc= Document() doc.styles['Normal'].font.name = u'宋 阅读全文
posted @ 2024-07-06 15:08 hermione1985 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Python代码中需包含 def get_resource_path(relative_path): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative_path) return os.path.join(o 阅读全文
posted @ 2024-05-12 16:55 hermione1985 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 问题一:Error loading Python DLL 出错原因:发现是因为 Python 3.9 不再支持 win7 了,需要把 Python 版本降到 Python3.8 及以下。 另外32为的python解释器打包的exe可以在64位机器上运行。 阅读全文
posted @ 2024-04-12 19:40 hermione1985 阅读(182) 评论(0) 推荐(0) 编辑
摘要: pycharm配置了镜像,又想删除了。找到这个路径底下的pip.ini重命名或者删除文件即可 阅读全文
posted @ 2023-11-18 18:57 hermione1985 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 如何使用dataframe.loc在Python中进行数据选择和筛选 dataframe是一种常用的数据结构,它可以同时存储多种数据类型,并且可以轻松地进行数据的选择和筛选。在Python中,使用dataframe.loc方法可以方便地选择和筛选数据,本文将从多个方面介绍如何使用dataframe. 阅读全文
posted @ 2023-09-24 15:30 hermione1985 阅读(264) 评论(0) 推荐(0) 编辑
摘要: stringstream的用法,动态创建不同文件名 for(int i=0;i<n;i++) { string filename; stringstream ss; ss << "file" << i << ".txt"; ss >> filename; ss.clear(); } auto的用法, 阅读全文
posted @ 2023-06-21 21:10 hermione1985 阅读(8) 评论(0) 推荐(0) 编辑
摘要: C++ getline函数用法 getline()函数是一个比较常见的函数。根据名字直接望文生义,就知道这个函数是来完成读入一行数据。 下面就对C++ -- getline()函数的用法说明,以及getline()函数作为while条件的问题,总结一下: 在C++中本质上有两种getline函数: 阅读全文
posted @ 2023-05-22 16:55 hermione1985 阅读(66) 评论(0) 推荐(0) 编辑
摘要: STL中的容器相当“聪明”,它们提供了迭代器,以便进行向后和向前的遍历(通过begin、end、rbegin等);它们告诉你所包含的元素类型(通过它们的value_type类型定义);在插入和删除的过程中,它们自己进行必要的内存管理;它们报告自己有多少对象,最多能容纳多少对象(分别通过size和ma 阅读全文
posted @ 2023-05-04 10:44 hermione1985 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 介绍采用python_docx模块处理word文档的基本技巧,特别是图片如何提取和写入。 python_docx模块只能处理docx,不支持doc,如需使用,要进行转换。代码入下: from win32com import client as wc word = wc.Dispatch("Word. 阅读全文
posted @ 2022-12-16 11:17 hermione1985 阅读(348) 评论(0) 推荐(0) 编辑
摘要: Warning: `importlib-metadata` version is incompatible with `setuptools` 解决方案:升级 importlib-metadata 版本 pip install importlib-metadata==4.12 阅读全文
posted @ 2022-12-02 10:03 hermione1985 阅读(1129) 评论(0) 推荐(0) 编辑