![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
LiangJun.py
一不小心学了数据挖掘
展开
-
python3中pathlib库的Path类方法汇总
1、调用库 1 frompathlibimportPath 2、创建path对象p = Path(file)3、方法总结 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2...转载 2020-06-19 11:58:38 · 1235 阅读 · 0 评论 -
用 python 来操作 docx(使用 docx 库操作 docx 格式文件)
docx 库文章结构: 一、docx 基本用,创建 docx 文件并添加数据 二、深入理解文本格式(format),并设置所格式属性(attribute) 三、深入理解样式(styles),以及如何运用样式 四、常用样式(style)示例 一、docx基本用法,创建docx 文件并添加数据 官方文档:https://python-docx.readthed...转载 2018-12-16 21:55:56 · 4009 阅读 · 0 评论 -
python bytes与字符串的相互转化
原文地址:http://www.cnblogs.com/xiandedanteng/p/9009964.html# bytes转字符串方式一b=b'\xe9\x80\x86\xe7\x81\xab'string=str(b,'utf-8')print(string)# bytes转字符串方式二b=b'\xe9\x80\x86\xe7\x81\xab'string=b.decod...转载 2019-01-15 17:04:32 · 11130 阅读 · 1 评论 -
python把日期转换为秒数;日期转为字符串;datetime、date
原文地址:https://www.cnblogs.com/shengulong/p/8922672.html 1、秒数是相对于1970.1.1号的秒数2、日期的模块有time、datetime3、import datetimet = datetime.datetime(2009, 10, 21, 0, 0, 10, 10) 分别是年份、月份、日、小时、分钟、秒、微妙(1...转载 2019-01-28 17:00:59 · 10603 阅读 · 0 评论 -
When using pathlib, getting error: TypeError: invalid file: PosixPath('example.txt')
from pathlib import Pathfilename = Path(__file__).parent / "example.txt"contents = open(filename, "r").read()But I get this error on some machines:TypeError: invalid file: PosixPath('example...转载 2019-07-16 15:16:25 · 2209 阅读 · 0 评论