摘要: 导入正则表达式库:在使用正则表达式之前,需要导入Python中的re模块。 import re 模式匹配:使用re.search()方法可以在字符串中搜索匹配的模式。该方法返回一个Match对象,如果找不到匹配则为None。 import re text = "Hello, world!" matc 阅读全文
posted @ 2023-09-18 08:32 祺琪 阅读(64) 评论(0) 推荐(0)
摘要: https://blog.csdn.net/qq_41556318/category_9283243.html?spm=1001.2014.3001.5482 #tkinter 使用方法详解 说明import tkinter as tk master = tk.Tk() tk.Label(maste 阅读全文
posted @ 2023-09-16 12:37 祺琪 阅读(66) 评论(0) 推荐(0)
摘要: from selenium.common.exceptions import NoSuchElementException, TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.su 阅读全文
posted @ 2023-09-09 16:34 祺琪 阅读(17) 评论(0) 推荐(0)
摘要: pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com python -m pip install --upgrade pip python -m pip install --upgrade pi 阅读全文
posted @ 2023-09-07 08:44 祺琪 阅读(13) 评论(0) 推荐(0)
摘要: word的一个常用库:python-docx。 # 读取文档中的段落 for para in doc.paragraphs: print(para.text) # 读取文档中的表格 for table in doc.tables: for row in table.rows: for cell in 阅读全文
posted @ 2023-09-07 08:18 祺琪 阅读(1708) 评论(0) 推荐(0)
摘要: for paragraph in doc.paragraphs: for run in paragraph.runs: if run.element.xml.startswith('<w:drawing'): inline = run.inline_shapes[0] if inline.has_i 阅读全文
posted @ 2023-09-06 15:23 祺琪 阅读(607) 评论(0) 推荐(0)
摘要: def iter_block_items(parent): """ Generate a reference to each paragraph and table child within *parent*, in document order. Each returned value is an 阅读全文
posted @ 2023-09-06 15:10 祺琪 阅读(264) 评论(0) 推荐(0)
摘要: import re import os#需要批量替换内容文件所处的文件夹地址 filepath = r'D:\Python-study\word-test\test'#该文件夹下的所有文件名列表 fileList = os.listdir(filepath) print(fileList)#保存文件 阅读全文
posted @ 2023-09-06 10:56 祺琪 阅读(324) 评论(0) 推荐(0)
摘要: import docx from docx.document import Document from docx.table import _Cell, Table from docx.oxml.text.paragraph import CT_P from docx.text.paragraph 阅读全文
posted @ 2023-09-06 08:48 祺琪 阅读(422) 评论(1) 推荐(0)
摘要: # 使用import导入os模块 import os # 将乔老师的答题卡文件夹路径 /Users/qiao/answerKey 赋值给变量allKeyPath allKeyPath = "/Users/qiao/answerKey" # 使用os.listdir()函数获取该路径下所有的文件,并赋 阅读全文
posted @ 2023-09-03 15:47 祺琪 阅读(204) 评论(0) 推荐(0)