摘要: import os import fnmatch ls=os.listdir(r"E:\pdf") #列出文件夹下所有的文件 for 文件名 in ls: if fnmatch.fnmatch(文件名,"[!a-z].pdf"): print(文件名) 1.pdf2.pdf3.pdf4.pdf>>> 阅读全文
posted @ 2020-07-14 22:17 马蹄哒哒 阅读(302) 评论(2) 推荐(0)
摘要: import glob import os os.chdir(r"E:\pdf") filedir=glob.glob("**\*.txt",recursive=True) #glob.iglob用也一样 for i in filedir: print(i) 文本.txt文件夹_1\文本.txt文件 阅读全文
posted @ 2020-07-14 22:06 马蹄哒哒 阅读(1144) 评论(0) 推荐(0)
摘要: import re >>> c="PandAs练习.xlsx" >>> re.match(".*pandas.*",c,re.I) <re.Match object; span=(0, 13), match='PandAs练习.xlsx'> >>> d=re.match(".*pandas.*",c 阅读全文
posted @ 2020-07-14 21:57 马蹄哒哒 阅读(874) 评论(0) 推荐(0)
摘要: a="文件1.xlsx" 点的位置=a.rfind(".") #取出.xlsx b=a[点的位置:] 阅读全文
posted @ 2020-07-14 21:49 马蹄哒哒 阅读(482) 评论(0) 推荐(0)
摘要: import os j=0 for 文件夹路径,子文件夹列表,文件列表 in os.walk(r'E:\pdf'): #生成所有的文件路径 for i in 文件列表: print(文件夹路径+i) j+=1 print('发现了{}个文件'.format(j)) 阅读全文
posted @ 2020-07-14 13:28 马蹄哒哒 阅读(477) 评论(0) 推荐(0)
摘要: from PyPDF2 import PdfFileReader,PdfFileWriter 写pdf=PdfFileWriter() for i in range(1,5): 读pdf=PdfFileReader('{}.pdf'.format(i)) for j in range(读pdf.ge 阅读全文
posted @ 2020-07-14 11:27 马蹄哒哒 阅读(200) 评论(0) 推荐(0)
摘要: from PyPDF2 import PdfFileReader,PdfFileWriter 读pdf=PdfFileReader(r'E:\pdf\python.pdf') for i in range(读pdf.getNumPages()): 写pdf=PdfFileWriter() 写pdf. 阅读全文
posted @ 2020-07-14 11:18 马蹄哒哒 阅读(227) 评论(0) 推荐(0)
摘要: import pdfplumber import pandas #将表格写进csv文件 #with pdfplumber.open(r'E:\pdf\表格.pdf') as f: #for page in f.pages: #for table in page.extract_tables(): # 阅读全文
posted @ 2020-07-14 11:04 马蹄哒哒 阅读(517) 评论(0) 推荐(0)