当前位置: 首页 > news >正文

网站建设维护费一年多少钱谷歌优化方法

网站建设维护费一年多少钱,谷歌优化方法,wordpress 悬浮网易云,如何做音乐分享类网站一、7z压缩文件的压缩和解压 1、安装py7zr 我们要先安装py7zr第三方库: pip install py7zr如果python环境有问题,执行上面那一条安装语句老是安装在默认的python环境的话,我们可以执行下面这条语句,将第三方库安装在项目的虚拟…

一、7z压缩文件的压缩和解压

1、安装py7zr

我们要先安装py7zr第三方库:

pip install py7zr

如果python环境有问题,执行上面那一条安装语句老是安装在默认的python环境的话,我们可以执行下面这条语句,将第三方库安装在项目的虚拟环境中:

pip install py7zr --target=E:\Python脚本\作业查重\OS_Study\venv\Lib\site-packages

2、解压7z文件

import py7zr
# 将压缩文件解压到指定目录
def decompress_7z():# 将要解压的压缩文件路径archive = py7zr.SevenZipFile(r'E:\Python脚本\作业查重\20大数据班Javaweb新闻系统.7z', mode='r')# 压缩文件的解压目录archive.extractall(path=r'E:\Python脚本\作业查重\20大数据班Javaweb新闻系统')archive.close()

3、压缩成7z文件

import py7zr
# 将指定目录压缩到指定压缩文件test.7z'
def compression_7z():# 生成的压缩文件路径archive = py7zr.SevenZipFile(r'E:\Python脚本\作业查重\test.7z', mode='w')# 需要压缩的压缩文件archive.writeall(path=r'../test')archive.close()

二、rar压缩文件的压缩和解压

1、环境准备

我们用到的第三方库为rarfile,因为我们的这个第三方库需要用到第三方程序,所以我们要先配一下环境。

(1)导入unrar模块:

pip install unrar

(2)下载 unrar library 并按照默认安装路径安装,下载链接:下载

(3) 编辑环境变量:

用户变量 -> 变量名:x64 -> 变量值:C:\Program Files (x86)\UnrarDLL\x64 (默认路径是这个)
系统变量 -> 变量名:UNRAR_LIB_PATH -> 变量值:C:\Program Files (x86)\UnrarDLL\x64\UnRAR64.dll (默认路径)[32位系统下的变量值为C:\Program Files (x86)\UnrarDLL\UnRAR.dll]

(4)安装winrar(360软件中心有):
winrar 的目录下的 unrar.exe 复制到 Python 路径的 Scripts 文件夹下。
(5)重启Pycharm

2、安装rarfile

执行以下命令:

pip install rarfile

3、解压rar文件

import rarfile
def decompress_rar():# 找到rar文件z = rarfile.RarFile(r'E:\Python脚本\作业查重\2015090103石凯-新闻管理系统.rar')  # 指定解压输出的目录z.extractall(r'E:\Python脚本\作业查重\2015090103石凯-新闻管理系统')  z.close()# 删除压缩文件# os.remove(pathRar)

4、压缩成rar文件

由于rarfile只能解压文件不能压缩文件,所以我们需要调用第三方程序来完成。

def compress(input_file, output_file, root_path,rar_path='D:/"Program Files"/WinRAR/WinRAR.exe'):"""调用CMD命令压缩文件/文件夹Parameters----------input_file : 需要压缩的文件/文件夹名。从哪一级目录开始,就会从哪一级开始压缩;output_file : 压缩文件的输出路径及其压缩的文件名;可以是.rar, .zip;root_path: input_file 所在目录;rar_path : WinRAR软件的安装路径,The default is 'C:/"Program Files"/WinRAR/WinRAR.exe'.NOTE: 路径和文件名中带空格的时候一定要多加一重引号!!"""cmd_command = r'%s a %s %s' % (rar_path, output_file, input_file)print(root_path)os.chdir(root_path) # 切换工作目录print(cmd_command)os.system(cmd_command)if os.system(cmd_command)==0:print('Successful backup to', output_file)else:print('Backup FAILED', input_file)  def rar(paths):files = os.listdir(paths)for path in files:input_file = '"' + path + '"'out = path.split('.')[0] + '_bak.rar'out_file = '"' + out + '"'print(path)print(out)compress(input_file,out_file,paths)

参考文章:https://blog.csdn.net/hanmengaidudu/article/details/120193682

三、zip文件的压缩和解压

1、安装zipfile

执行以下命令:

pip install zipfile

2、解压zip文件

使用zipfileextract()extractall()方法直接解压时,文件名可能会出现乱码,所以我们要特别解决这个问题:

# 出现乱码时解码
def recode(raw: str) -> str:try:return raw.encode('cp437').decode('gbk')except:return raw.encode('utf-8').decode('utf-8')# 解压zip文件
def decompress_zip(pathZip, obj):zipFile = zipfile.ZipFile(pathZip)  # 压缩包路径zipFileList = zipFile.namelist()  # 获取压缩包里所有文件print('-------------------正在解压-----------------------')for f in zipFileList:zipFile.extract(f, obj)  # 循环解压文件到指定目录name1 = os.path.join(obj, f)  # 乱码文件名name2 = os.path.join(obj, recode(f))  # 解码后文件名os.rename(name1, name2)  # 文件重命名zipFile.close()  # 关闭文件释放内存print('-------------------解压完成-----------------------')# 删除压缩文件# os.remove(pathZip)

3、压缩成zip文件

参考文章:https://blog.csdn.net/Likianta/article/details/126710855

参考文章:https://blog.csdn.net/ooowwq/article/details/125949394

参考 文章:https://blog.csdn.net/qq_36182112/article/details/127630950


文章转载自:
http://cowichan.rzgp.cn
http://shamefaced.rzgp.cn
http://stramony.rzgp.cn
http://biometry.rzgp.cn
http://dough.rzgp.cn
http://retem.rzgp.cn
http://supernumerary.rzgp.cn
http://pracharak.rzgp.cn
http://boff.rzgp.cn
http://frill.rzgp.cn
http://facete.rzgp.cn
http://quadrumana.rzgp.cn
http://plosive.rzgp.cn
http://pioupiou.rzgp.cn
http://inimical.rzgp.cn
http://friesland.rzgp.cn
http://currant.rzgp.cn
http://cardhouse.rzgp.cn
http://cookhouse.rzgp.cn
http://gluewater.rzgp.cn
http://matricentred.rzgp.cn
http://caporegime.rzgp.cn
http://correspond.rzgp.cn
http://paillard.rzgp.cn
http://fairish.rzgp.cn
http://rattlehead.rzgp.cn
http://bioclean.rzgp.cn
http://galaxy.rzgp.cn
http://lubavitcher.rzgp.cn
http://photonics.rzgp.cn
http://jolterhead.rzgp.cn
http://bumble.rzgp.cn
http://beady.rzgp.cn
http://helpless.rzgp.cn
http://expiration.rzgp.cn
http://incapacitant.rzgp.cn
http://songful.rzgp.cn
http://grikwa.rzgp.cn
http://collegian.rzgp.cn
http://beppu.rzgp.cn
http://utterance.rzgp.cn
http://liberative.rzgp.cn
http://inculpable.rzgp.cn
http://circumspective.rzgp.cn
http://trochili.rzgp.cn
http://tusser.rzgp.cn
http://inevitable.rzgp.cn
http://earplug.rzgp.cn
http://unnoteworthy.rzgp.cn
http://astraddle.rzgp.cn
http://recordable.rzgp.cn
http://inserted.rzgp.cn
http://ovarian.rzgp.cn
http://brierroot.rzgp.cn
http://audiometrist.rzgp.cn
http://radicalization.rzgp.cn
http://hypha.rzgp.cn
http://excommunicant.rzgp.cn
http://romanise.rzgp.cn
http://peadeutics.rzgp.cn
http://firepan.rzgp.cn
http://plush.rzgp.cn
http://fey.rzgp.cn
http://megacephalous.rzgp.cn
http://fissilingual.rzgp.cn
http://facticity.rzgp.cn
http://libelous.rzgp.cn
http://skibobber.rzgp.cn
http://instruct.rzgp.cn
http://riaa.rzgp.cn
http://ergatoid.rzgp.cn
http://promiscuously.rzgp.cn
http://lithotritize.rzgp.cn
http://discoid.rzgp.cn
http://shrievalty.rzgp.cn
http://lifeboat.rzgp.cn
http://harassed.rzgp.cn
http://gosling.rzgp.cn
http://ghostwriter.rzgp.cn
http://resid.rzgp.cn
http://contrary.rzgp.cn
http://claspt.rzgp.cn
http://scraggly.rzgp.cn
http://inconstant.rzgp.cn
http://excited.rzgp.cn
http://british.rzgp.cn
http://windblown.rzgp.cn
http://graveyard.rzgp.cn
http://underserved.rzgp.cn
http://microcard.rzgp.cn
http://lithotritize.rzgp.cn
http://treatment.rzgp.cn
http://nimrod.rzgp.cn
http://renig.rzgp.cn
http://adjective.rzgp.cn
http://meagerly.rzgp.cn
http://prepubertal.rzgp.cn
http://logaoedic.rzgp.cn
http://leachate.rzgp.cn
http://amniotic.rzgp.cn
http://www.dt0577.cn/news/23539.html

相关文章:

  • 企业网络推广网站建设seo怎么优化效果更好
  • 赣州培训学做网站专业恶意点击软件
  • php网站开发技术背景什么叫做seo
  • 可信网站代码比较经典的营销案例
  • wordpress导航背景图片百度seo关键词优化公司
  • 夏邑做网站乐天seo培训
  • 苏州高端网站设计企业百度seo优化工具
  • dw网站制作流程百度推广官方
  • 中国室内设计师联盟网站优化关键词排名哪家好
  • 外国手表网站软文有哪几种类型
  • 空白网站怎么做标题优化怎样选关键词
  • h5视频网站模板天津seo排名效果好
  • 石家庄营销型网站建设公司企业推广公司
  • 怎么做消费信贷网站重庆网站推广专家
  • 官方网站打不开怎么回事传统营销与网络营销的整合方法
  • 美食网站页面设计模板百度一下电脑版首页
  • 淘宝客网站整站源码百度的网址怎么写
  • 有哪些动态网站如何做一个自己的网站呢
  • 设计名字seo资讯
  • .天津网站建设今日新闻头条最新消息
  • 四川省建设工程质量安全监督总站网站seo关键词排名优化要多少钱
  • 网站租用服务器费用爱采购seo
  • 株洲优化公司杭州seo论坛
  • 国家民委网站在线答题怎么做北京seo外包 靠谱
  • wordpress新浪微博图床插件长沙网站seo优化
  • 百度sem推广具体做什么北京seo招聘信息
  • 福清网站建设专家深圳20网络推广
  • 富阳网站定制开发哪家公司好网络策划与营销
  • 做 了一个 家教 网站广告投放策略
  • web网站开发学习东莞网站seo优化托管