![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程语言
--点点--
这个作者很懒,什么都没留下…
展开
-
python的魔术方法
迭代器 如果一个类包含了__iter__方法,而且该方法返回了一个包含__next__方法的对象,即为迭代器 # 示例1,返回一个迭代对象 class A: def __iter__(self): return list('abcd').__iter__() # 示例2 自身可迭代 class A: def __iter__(self): self.data = list('abcd') return self def __next原创 2022-01-24 17:45:41 · 498 阅读 · 0 评论 -
python处理pdf文件的包分析
需要处理pdf文件,因此使用pip search pdf搜索了一下,将相关包的功能做了一下了解。 查看类型的包 包名 简述 项目地址 tc-pdf 查看给定pdf url 的第一页图像 https://pypi.org/project/tc-pdf/ 页面拆分类型的包 包名 简述 项目地址 pdf-splitter ...原创 2020-01-07 08:41:58 · 962 阅读 · 0 评论 -
Python正则表达式
# -*- coding: utf-8 -*- import re #%%排除字符 regular = r"[^ab]\w+" #非a或b字符开始的字符串 print(re.search(regular,"dbc")) #%%匹配所有字符串 regular = r"[\d\D]+" print(re.search(regular,"dbc")) #%%忽略优先量词,表示优先匹配后方内容...原创 2018-02-25 18:29:15 · 259 阅读 · 0 评论 -
python open函数
open(name[, mode[, buffering]])打开一个文件,将该文件作为文件对象返回,如果文件无法打开,则返回IOError。name is the file name to be openedmode is a string indicating how the file is to be opened.The most commonly-used values of mode ...转载 2018-05-13 09:24:44 · 1044 阅读 · 0 评论 -
openrefine的 General Refine Expression Language(GREL)
字符串替换value.replace(";", ",") 字符串用逗号分割,将结果去重,最后用逗号连起来value.split(", ").uniques().join(", ") 字符串连接"TITLE: " + value + "." 删除数字单元格的内容value.replace(/^\d+ /, "") 反向引用的正则value.replac...原创 2019-03-26 11:27:08 · 750 阅读 · 0 评论