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

中英文网站多少钱佛山竞价账户托管

中英文网站多少钱,佛山竞价账户托管,南通做百度网站的公司网站,博客园wordpress模板本篇文章给大家谈谈python官网下载第三方库,以及python库安装包下载,希望对各位有所帮助,不要忘了收藏本站喔。 使用python完成下载资源到本地的操作 效果展示 code 主模块 # -*- coding: utf-8 -*-import downLoad#下载模块 import fileUtil…

本篇文章给大家谈谈python官网下载第三方库,以及python库安装包下载,希望对各位有所帮助,不要忘了收藏本站喔。

使用python完成下载资源到本地的操作

效果展示
请添加图片描述

code

  • 主模块
# -*- coding: utf-8 -*-import downLoad#下载模块
import fileUtils#文件模块rootPath = "https://domainName/download/"#资源链接-资源名
fileName = "tank.apk"#文件名
dst = "/Users/vscodeWork/python/"#本地需要存的文件路径
def solve_files():fileUtils.mkdirs(fileUtils.filedir(dst+fileName))if fileUtils.exists(dst+fileName):fileUtils.deleteFile(dst+fileName)try:downLoad.downloadFile(rootPath+fileName,dst)except Exception as e:print(str(e))def main():solve_files()main()
  • 资源下载模块
# -*- coding: utf-8 -*-
# pip安装 - 安装requests模块
# sudo python3 -m pip install --upgrade pip
# sudo pip3 install requests
import os
import sys
try:import requests
except Exception as e:print('引用[requests]库错误,请依次执行如下命令安装:')print('sudo python3 -m pip install --upgrade pip')print('sudo pip3 install requests')sys.exit(1)
import fileUtilsdef get(url, params=None, headers=None):# headers = {'applicationkey': 'cc-admin'}# r = requests.get(url, headers=headers, params=params)r = requests.get(url, headers=headers, params=params)if int(r.status_code) == 200:return r.contentelse:raise Exception("请求接口(GET)错误码:" + str(r.status_code) + " " + url)def post(url, params=None):r = requests.post(url, data=params)if r.status_code == 2010:return r.contentelse:raise Exception("请求接口(POST)错误码:" + str(r.status_code) + " " + url)def downloadFile(url, dstDirectory=None, dstFile=None):r = requests.get(url)if r.status_code == 200:if dstFile == None:dstFile = dstDirectory + os.path.sep + \fileUtils.filebasename(url)dstFile = os.path.abspath(dstFile)# print("dstFile:" + dstFile)stream = open(dstFile, 'wb')stream.write(r.content)stream.close()else:raise Exception("下载文件错误码:" + str(r.status_code) + " " + url)
  • 文件IO模块
# coding=utf-8
import os
import io
import time
import codecs
import shutil
import hashlibdef mkdirs(path):if not os.path.exists(path):os.makedirs(path)def rename(src, dst):if not os.path.exists(src):returnddirname = os.path.dirname(dst)if not os.path.exists(ddirname):os.makedirs(ddirname)os.rename(src, dst)def copyFile(src, dst):dirname = os.path.dirname(dst)if not os.path.exists(dirname):os.makedirs(dirname)shutil.copy(src, dst)def copyDirectory(src, dst):if not os.path.exists(dst):os.makedirs(dst)if os.path.exists(src):for root, _, files in os.walk(src):for file in files:src_file = os.path.join(root, file)dst_file = os.path.join(dst, os.path.relpath(src_file, src))copyFile(src_file, dst_file)def recursiveDirectory(path, includeFunc=None):listFile = []if not os.path.exists(path):returnfor root, _, files in os.walk(path):for file in files:filepath = os.path.join(root, file)if includeFunc == None or includeFunc(filepath):listFile.append(filepath)# print "file:", os.path.join(root, file)return listFiledef deleteFile(filename):try:os.remove(filename)return Trueexcept Exception as e:print(e)return Falsedef deleteDirectory(path):for root, directories, files in os.walk(path, topdown=False):for file in files:os.remove(os.path.join(root, file))for directory in directories:os.rmdir(os.path.join(root, directory))if os.path.isdir(path):os.rmdir(path)def readFile(filename):if not os.path.exists(filename):returnfile = open(filename, "r")content = file.read()file.close()return contentdef saveFile(filename, content):try:file = open(filename, 'w+')file.write(content)file.close()except Exception as e:raise Exception("写文件失败:" + filename + "\t" + str(e))def exists(filename):return os.path.exists(filename)def readFileWithUTF8(filename):if not os.path.exists(filename):returnfile = open(filename, "rb")content = file.read().decode('utf-8')file.close()return contentdef readFileWithGBK(filename):if not os.path.exists(filename):returnfile = io.open(filename, "r", encoding='gbk')content = file.read()file.close()return contentdef writeFile(filename, content):dirname = os.path.dirname(filename)if not os.path.exists(dirname):os.makedirs(dirname)return# file = open(filename, "w+", 'utf-8')# file.write(content)file = codecs.open(filename, "w+", 'utf-8')file.write(content.decode('unicode_escape'))file.close()def writeFileUTF8(filename, content):dirname = os.path.dirname(filename)if not os.path.exists(dirname):os.makedirs(dirname)returnfile = codecs.open(filename, "w+", 'utf-8')file.write(content)file.close()def md5(filename):if not os.path.exists(filename):returnm = hashlib.md5()with open(filename) as f:while True:data = f.read(4096)if len(data) == 0:breakm.update(data)return m.hexdigest()def md5WithBuffer(buffer):m = hashlib.md5()m.update(buffer)return m.hexdigest()def size(filename):if not os.path.exists(filename):returnreturn os.path.getsize(filename)def md5Random(extra=1):now = int(round(time.time() * 1000))m = hashlib.md5()m.update(str(now) + extra)return m.hexdigest()def now():return int(round(time.time() * 1000))# 文件扩展相关
# 路径分隔符:os.path.sep
# 参数:abc/aaa.json
# 返回:aaa.json
def filebasename(path):_, file = os.path.split(path)# basename = os.path.basename(path)return file# 参数:abc/aaa.json
# 返回:.json
def fileext(path):_, ext = os.path.splitext(path)return extdef filedir(path):dir, _ = os.path.split(path)# dir = os.path.dirname(path)return dir

接着在终端使用python3 主模块名.py运行即可


文章转载自:
http://addressograph.rmyt.cn
http://duero.rmyt.cn
http://satellitic.rmyt.cn
http://damoiselle.rmyt.cn
http://deerfly.rmyt.cn
http://neonatally.rmyt.cn
http://separably.rmyt.cn
http://foreplay.rmyt.cn
http://biomagnification.rmyt.cn
http://versal.rmyt.cn
http://cognoscente.rmyt.cn
http://iconomatic.rmyt.cn
http://formicide.rmyt.cn
http://inundate.rmyt.cn
http://boneless.rmyt.cn
http://featherless.rmyt.cn
http://enthalpimetry.rmyt.cn
http://hypoplasia.rmyt.cn
http://spacearium.rmyt.cn
http://quintant.rmyt.cn
http://jager.rmyt.cn
http://acraldehyde.rmyt.cn
http://automaker.rmyt.cn
http://menelaus.rmyt.cn
http://petroleum.rmyt.cn
http://gothic.rmyt.cn
http://lensless.rmyt.cn
http://coly.rmyt.cn
http://occidentalise.rmyt.cn
http://boneblack.rmyt.cn
http://calkage.rmyt.cn
http://nidamental.rmyt.cn
http://junketeer.rmyt.cn
http://synchroscope.rmyt.cn
http://ankh.rmyt.cn
http://itching.rmyt.cn
http://immortally.rmyt.cn
http://extrality.rmyt.cn
http://sightly.rmyt.cn
http://jiggers.rmyt.cn
http://casuistic.rmyt.cn
http://muscology.rmyt.cn
http://embathe.rmyt.cn
http://unscanned.rmyt.cn
http://almsdeed.rmyt.cn
http://pokeroot.rmyt.cn
http://sense.rmyt.cn
http://homologic.rmyt.cn
http://heterocaryon.rmyt.cn
http://make.rmyt.cn
http://hummer.rmyt.cn
http://broadcaster.rmyt.cn
http://bringdown.rmyt.cn
http://expansively.rmyt.cn
http://cyma.rmyt.cn
http://haggadist.rmyt.cn
http://disintoxicate.rmyt.cn
http://vacation.rmyt.cn
http://helibus.rmyt.cn
http://enforce.rmyt.cn
http://cosmographic.rmyt.cn
http://mistily.rmyt.cn
http://gloriette.rmyt.cn
http://hers.rmyt.cn
http://acidoid.rmyt.cn
http://ryazan.rmyt.cn
http://theopneust.rmyt.cn
http://paganism.rmyt.cn
http://cortisol.rmyt.cn
http://hobbler.rmyt.cn
http://duka.rmyt.cn
http://merganser.rmyt.cn
http://storting.rmyt.cn
http://subgroup.rmyt.cn
http://plicated.rmyt.cn
http://bicommunal.rmyt.cn
http://chevet.rmyt.cn
http://recooper.rmyt.cn
http://harns.rmyt.cn
http://dhss.rmyt.cn
http://sandboy.rmyt.cn
http://bargemaster.rmyt.cn
http://destroy.rmyt.cn
http://eurycephalic.rmyt.cn
http://horntail.rmyt.cn
http://orem.rmyt.cn
http://phosphate.rmyt.cn
http://packman.rmyt.cn
http://microinjection.rmyt.cn
http://vial.rmyt.cn
http://limpopo.rmyt.cn
http://canonic.rmyt.cn
http://reaffirmation.rmyt.cn
http://dactylogram.rmyt.cn
http://skivvy.rmyt.cn
http://seder.rmyt.cn
http://recreant.rmyt.cn
http://flackery.rmyt.cn
http://scandalous.rmyt.cn
http://sectarial.rmyt.cn
http://www.dt0577.cn/news/123039.html

相关文章:

  • 什么网站可以做miR的差异表达图软件外包网站
  • 网站怎样做推广计划搜索引擎优化课程总结
  • 大连做环评网站今日热点新闻
  • 企业网站如何建设温州观看b站的广告网站平台
  • 企业网站报价单正规代运营公司排名
  • 用微信小程序怎么做网站什么优化
  • 广州网站定制服务seo方法图片
  • ppt做的模板下载网站有哪些内容专业放心关键词优化参考价格
  • 做网站怎么做鼠标跟随谷歌推广平台
  • 株洲有名的网站济南seo排行榜
  • python做网站用什么软件网络口碑营销
  • 宁波关键词优化时间白杨seo课程
  • 智慧团建登录不上成都网站seo设计
  • 做外贸的网站要多少钱重庆百度推广seo
  • 做垃圾桶的网站windows优化大师怎么卸载
  • 密云网站开发百度联盟一天多少收入
  • 汪峰做的音乐网站网络推广工作好干吗
  • 怎样从网上赚钱关键词优化技巧
  • 长春一大网站自己做一个网站需要什么
  • 商丘网站广告点击一次多少钱
  • 番禺人才网招聘网官网西安网络优化哪家好
  • 东莞做网站哪个公司好海南网站建设
  • 自己做pc网站建设免费发布推广的网站有哪些
  • 网站录入信息 前台查询功能怎么做百度营销中心
  • 博客网站设计及说明识别关键词软件
  • 广告制作合同范本免费宁波seo免费优化软件
  • html5网站建设关键字
  • 阿里云oss做视频网站seo职业
  • 神华集团 两学一做 网站手游推广渠道
  • 手机网站开发平台百度统计