精华内容
下载资源
问答
  • python导出excel.rar

    2019-05-21 17:47:11
    利用python 导出excel 函数 导出数据到excel 封装了一个函数 传入数据 以及导出的数据名或叫表名 ,xls文件名最后以时间戳加表名导出
  • 主要介绍了使用Python导出Excel图表以及导出为图片的方法,Python相关模块在Windows下操作office非常方便,需要的朋友可以参考下
  • python导出导入pip安装包本教程为python导出导入pip安装包导出requirements方法安装requirements方法 本教程为python导出导入pip安装包 记得导入导出包的时候要想激活虚拟环境。 导出requirements方法 pip freeze &...

    本教程为python导出导入pip安装包

    记得导入导出包的时候要想激活虚拟环境。

    导出requirements方法

    pip freeze > requirements.txt
    

    安装requirements方法

    pip install -r requirements.txt
    
    展开全文
  • 主要介绍了Python导出DBF文件到Excel的方法,实例分析了Python基于win32com模块实现文件导出与转换的相关技巧,需要的朋友可以参考下
  • 参考博客

    参考博客

    pip install pipreqs
    
    使用的时候也很简单,进入项目的根目录
    
    pipreqs ./
    
    展开全文
  • Python 导出gitlab项目

    2020-09-22 19:14:44
    Python 导出gitlab项目 安装python-gitlab模块 pip install python-gitlab python3 pip3 install python-gitlab gitlab 申请api access token 路径 User Settings -> Access Tokens 配置 python-gitlab.cfg...

    Python 导出gitlab项目

    1. 安装python-gitlab模块

      pip install python-gitlab
      python3 
      pip3 install python-gitlab
      
    2. gitlab 申请api access token
      路径 User Settings -> Access Tokens

    3. 配置 python-gitlab.cfg,可以放在同一目录下

      [global]
       default = username
       ssh_verify = False
       timeout = 8
      
       [username]
       url = https://gitlab.com
       private_token = xxxxxxxxxxxx
      

    For API v4 use url https://gitlab.com, if you use API v3 use url
    https://gitlab.example.com

    1. 代码

      import gitlab
      gl = gitlab.Gitlab.from_config('username', ['python-gitlab.cfg'])
      projects = gl.projects.list()
      print(projects)
      
    2. 或者使用以下代码获取group项目

      import gitlab
      class GitlabAPI(object):
      	
          def __init__(self, *args, **kwargs):
              self.gl = gitlab.Gitlab('https://gitlab.com', private_token='xxxxxxxxxxxxx', api_version='4')
      
          # 可行 先获取所有group ID, 然后根据group ID 获取项目地址
          def get_all_group(self):
              return self.gl.groups.list(all=True)
          def get_group_by_id(self, groupID):
              group = self.gl.groups.get(groupID)
              projects = group.projects.list(all=True)
              result_list = []
              for project in projects:
                  result_list.append(project.http_url_to_repo)
              return result_list
      
      	
      apiObject = GitlabAPI()
      groupProjects = apiObject.get_group_by_id(填写获取到的groupID)
      print(groupProjects)
      
    展开全文
  • python导出GDB数据结构

    2017-10-25 09:58:00
    python导出arcgis gdb中所有图层、表的数据结构,包含数据名称、别名、记录数等。两个参数,gdb路径和输出结构表的存储路径。参数可在arcgis创建脚本时候设置。
  • 我用Python导出了两万行字符,做成了动画...

    万次阅读 多人点赞 2020-06-03 14:27:40
    我用Python导出了两万行字符,做成了动画... 如果感觉视频做的还不错,求点个赞鼓励一下~ 视频中的字符动画的文档和代码我这这里贴一下,大家想要做类似视频的话可以参考~~ 1、前面的字符效果 import os

    前几天看了B站Up主何同学的视频,有了这个导出字符文档做成视频想法,比我想象中要费时间,卡点实在是太难了…

    但是一旦脑子里有个想法,不实现出来浑身难受…

    这是视频 ↓↓↓

    我用Python导出了两万行字符,做成了动画...

    B站主页:https://space.bilibili.com/279911711

    如果感觉视频做的还不错,求点个赞鼓励一下~

    视频中的字符动画的文档和代码我这这里贴一下,大家想要做类似视频的话可以参考~~

    1、前面的字符效果

    import os #文件模块
    import random
    
    # "♡"
    snake1,snake2,snake3,snake4,snake5,snake6 = 0,0,0,0,0,0
    data = ""
    blank = 600
    blank2 = 600
    blank3 = 800
    default_texts = ["o","■","□"]
    repead = 6
    repead2 = 5
    repead3 = 8
    speed = 5
    food = "●●●●●"
    
    # 效果1
    while snake1 < 4:
    	index = 0
    	while index <= blank:
    		# print(index)
    		index += speed
    		text = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*repead + '</span>' + '</p>'
    		data += text + "\n" 
    		while index+speed >= blank:
    			index += (speed//2)
    			if index+(speed//2) > blank:
    				# print(index)
    				for i in [1,2,3,4,5]:
    					index += 1
    					text = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*(repead+i) + '</span>' + '</p>'
    					data += text + "\n" 
    			else:
    				text = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*repead + '</span>' + '</p>'
    				data += text + "\n" 
    			if index > blank:
    				food_data = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*(repead//2) + "<span style='color:orange;'>" + food + "</span>"  + default_texts[0]*(repead//2) + "</span></p>"
    				for i in [1,2,3,4,5]:
    					data += food_data + "\n" 
    				break
    		
    	while index >= 0:
    		# print("index",index)
    		while index+(speed//2) > blank:
    			# print("index22",index)
    			index -= (speed//2)
    			for i in [5,4,3,2,1]:
    				index -= 1
    				text = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*(repead+i) + '</span>' + '</p>'
    				# print(text)
    				data += text + "\n" 
    		if index < 0:
    			break
    		index -= speed
    		text = "<p style='font-size:1.0pt;color:red;font-family:Helvetica;mso-bidi-font-family:宋体'>"+'&nbsp;'*index + "<span style='font-size:40.0pt;'>" + default_texts[0]*repead + '</span>' + '</p>'
    		data += text + "\n" 
    	snake1 += 1
    	# print("data",data)
    
    # 效果2
    while snake2 < 50:
    	index = 0
    	if snake2 % 2 == 1:
    		time_blank = random.randint(0,(blank2//2))
    	else:
    		time_blank = random.randint((blank2//2),blank2)
    	while index < 6:
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+'&nbsp;'*time_blank + "<span style='font-size:20.0pt;'>" + default_texts[1]*repead2 + '</span>' + '</p>'
    		data += text + "\n" 
    		index +=1
    
    	index = 0
    	while index < 3:
    		data += "<p>&nbsp;</p>" + "\n" 
    		index +=1
    	snake2+=1
    
    # 效果3
    while snake3 < 50:
    	index = 0
    
    	default_text = random.choice(default_texts[1:])
    	if snake3 % 2 == 1:
    		time_blank = random.randint(0,(blank2//2))
    	else:
    		time_blank = random.randint((blank2//2),blank2)
    	while index < 6:
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+'&nbsp;'*time_blank + "<span style='font-size:20.0pt;'>" + default_text*repead2 + '</span>' + '</p>'
    		data += text + "\n" 
    		index +=1
    
    	index = 0
    	while index < 3:
    		data += "<p>&nbsp;</p>" + "\n" 
    		index +=1
    	snake3+=1
    
    
    # 效果4
    color_index = 1
    while snake4 < 15:
    	index = 0
    	default_text = default_texts[0]
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index <= blank3//repead3:
    		time_text = ""
    		for i in range(1, (repead3+1)):
    			time_text +=  "<span style='font-size:20.0pt;'>" + default_text + '</span>' + '&nbsp;'*index
    		# print(time_text)
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体;'>"+ time_text +"</p>"
    		div_text += text + "\n"
    		index +=1
    	color_index += 1
    	print(color_index)
    	data = data + div_text + "</div>"
    
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index >= 0:
    		time_text = ""
    		for i in range(1, (repead3+1)):
    			time_text +=  "<span style='font-size:20.0pt;'>" + default_text + '</span>' + '&nbsp;'*index
    		# print(time_text)
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体;'>"+time_text +"</p>"
    		div_text += text + "\n"
    		index -=1
    	color_index += 1
    	print(color_index)
    	data = data + div_text + "</div>"
    	snake4+=1
    
    # # 效果5
    # while snake5 < 20:
    # 	index = 0
    # 	default_text = default_texts[0]
    # 	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    # 	while index <= blank3//repead3:
    # 		time_text = ""
    # 		for i in range(1, (repead3+1)):
    # 			time_text +=  "<span style='font-size:20.0pt;'>" + default_text + '</span>' + '&nbsp;'*index
    # 		# print(time_text)
    # 		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    # 		div_text += text + "\n"
    # 		index +=1
    # 	color_index += 1
    # 	print(color_index)
    # 	data += div_text + "</div>"
    		
    
    # 	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    # 	while index >= 0:
    # 		time_text = ""
    # 		for i in range(1, (repead3+1)):
    # 			time_text = "<span style='font-size:20.0pt;'>" + default_text + '</span>' +'&nbsp;'*index + time_text
    # 		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    # 		div_text += text + "\n"
    # 		index -=1
    # 	color_index += 1
    # 	print(color_index)
    # 	data += div_text + "</div>"
    # 	snake5+=1
    
    # 效果6
    while snake6 < 7:
    	index = 0
    	default_text = default_texts[0]
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index <= blank3//repead3:
    		time_text = ""
    		for i in range(1, (repead3+1)):
    			time_text +=  "<span style='font-size:20.0pt;'>" + default_text + '</span>' + '&nbsp;'*index
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    		div_text += text + "\n"
    		index +=1
    	color_index += 1
    	print(color_index)
    	data += div_text + "</div>"
    
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index >= 0:
    		time_text = ""
    		index_length = 0
    		for i in range(1, (repead3+1)):
    			time_text = "<span style='font-size:20.0pt;'>" + default_text + '</span>' +'&nbsp;'*index + time_text
    			index_length += index
    		time_index = blank3 - index_length
    		time_text = '&nbsp;'*time_index + time_text
    		
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    		div_text += text + "\n"
    		index -=1
    	color_index += 1
    	print(color_index)
    	data += div_text + "</div>"
    
    	index = 0
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index <= blank3//repead3:
    		time_text = ""
    		index_length = blank3
    		for i in range(1, (repead3+1)):
    			time_text +=  "<span style='font-size:20.0pt;'>" + default_text + '</span>' + '&nbsp;'*index
    			index_length -= index
    		# print("index_length",index_length)
    		time_text = '&nbsp;'*index_length + time_text
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    		div_text += text + "\n"
    		index +=1
    	color_index += 1
    	print(color_index)
    	data += div_text + "</div>"
    
    	index = blank3//repead3
    	div_text = "<div class='simple-linear" + str(color_index) + "'>"
    	while index >= 0:
    		time_text = ""
    		# index_length = 0
    		for i in range(1, (repead3+1)):
    			time_text = "<span style='font-size:20.0pt;'>" + default_text + '</span>' +'&nbsp;'*index + time_text
    		text = "<p style='font-size:1.0pt;font-family:Helvetica;mso-bidi-font-family:宋体';>"+ time_text +"</p>"
    		div_text += text + "\n"
    		index -=1
    	color_index += 1
    	print(color_index)
    	data += div_text + "</div>"
    	snake6+=1
    
    
    # 效果7
    # http://www.divcss5.com/peise/
    style = '''<style>* {margin:0;padding:0;}
    .simple-linear1{ background: linear-gradient(#FFFFFF,#FFCC99);}
    .simple-linear2{ background: linear-gradient(#FFCC99,#FFFF99);}
    .simple-linear3{ background: linear-gradient(#FFFF99,#99CC99);}
    .simple-linear4{ background: linear-gradient(#99CC99,#FFCC99);}
    .simple-linear5{ background: linear-gradient(#FFCC99,#CCFF99);}
    .simple-linear6{ background: linear-gradient(#CCFF99,#CCCCCC);}
    .simple-linear7{ background: linear-gradient(#CCCCCC,#FFCC99);}
    .simple-linear8{ background: linear-gradient(#FFCC99,#FFFFCC);}
    .simple-linear9{ background: linear-gradient(#FFFFCC,#99CCFF);}
    .simple-linear10{ background: linear-gradient(#99CCFF,#FF9966);}
    .simple-linear11{ background: linear-gradient(#FF9966,#FFFFCC);}
    .simple-linear12{ background: linear-gradient(#FFFFCC,#99CC99);}
    .simple-linear13{ background: linear-gradient(#99CC99,#FF9900);}
    .simple-linear14{ background: linear-gradient(#FF9900,#FFFFCC);}
    .simple-linear15{ background: linear-gradient(#FFFFCC,#FF6666);}
    .simple-linear16{ background: linear-gradient(#FF6666,#CCCC33);}
    .simple-linear17{ background: linear-gradient(#CCCC33,#FFFF99);}
    .simple-linear18{ background: linear-gradient(#FFFF99,#CC9933);}
    .simple-linear19{ background: linear-gradient(#CC9933,#996600);}
    .simple-linear20{ background: linear-gradient(#996600,#FFCC33);}
    .simple-linear21{ background: linear-gradient(#FFCC33,#009966);}
    .simple-linear22{ background: linear-gradient(#009966,#FFFFCC);}
    .simple-linear23{ background: linear-gradient(#FFFFCC,#CC9933);}
    .simple-linear24{ background: linear-gradient(#CC9933,#FF6666);}
    .simple-linear25{ background: linear-gradient(#FF6666,#FF9900);}
    .simple-linear26{ background: linear-gradient(#FF9900,#FFFF00);}
    .simple-linear27{ background: linear-gradient(#FFFF00,#0099CC);}
    .simple-linear28{ background: linear-gradient(#0099CC,#99CC33);}
    .simple-linear29{ background: linear-gradient(#99CC33,#FF9900);}
    .simple-linear30{ background: linear-gradient(#FF9900,#FFCC00);}
    .simple-linear31{ background: linear-gradient(#FFCC00,#FF9933);}
    .simple-linear32{ background: linear-gradient(#FF9933,#99CC33);}
    .simple-linear33{ background: linear-gradient(#99CC33,#CC6699);}
    .simple-linear34{ background: linear-gradient(#CC6699,#FF9933);}
    .simple-linear35{ background: linear-gradient(#FF9933,#FFFF00);}
    .simple-linear36{ background: linear-gradient(#FFFF00,#3366CC);}
    .simple-linear37{ background: linear-gradient(#3366CC,#FF9933);}
    .simple-linear38{ background: linear-gradient(#FF9933,#FFFFCC);}
    .simple-linear39{ background: linear-gradient(#FFFFCC,#009966);}
    .simple-linear40{ background: linear-gradient(#009966,#FF6600);}
    .simple-linear41{ background: linear-gradient(#FF6600,#FFFF66);}
    .simple-linear42{ background: linear-gradient(#FFFF66,#009966);}
    .simple-linear43{ background: linear-gradient(#009966,#990033);}
    .simple-linear44{ background: linear-gradient(#990033,#CCFF66);}
    .simple-linear45{ background: linear-gradient(#CCFF66,#FF9900);}
    .simple-linear46{ background: linear-gradient(#FF9900,#FF9966);}
    .simple-linear47{ background: linear-gradient(#FF9966,#996600);}
    .simple-linear48{ background: linear-gradient(#996600,#CCCC00);}
    .simple-linear49{ background: linear-gradient(#CCCC00,#CC6600);}
    .simple-linear50{ background: linear-gradient(#CC6600,#999999);}
    .simple-linear51{ background: linear-gradient(#999999,#CCCC33);}
    .simple-linear52{ background: linear-gradient(#CCCC33,#CC6600);}
    .simple-linear53{ background: linear-gradient(#CC6600,#CCCC33);}
    .simple-linear54{ background: linear-gradient(#CCCC33,#336699);}
    .simple-linear55{ background: linear-gradient(#336699,#CC3366);}
    .simple-linear56{ background: linear-gradient(#CC3366,#FF9933);}
    .simple-linear57{ background: linear-gradient(#FF9933,#999966);}
    .simple-linear58{ background: linear-gradient(#999966,#663300);}
    .simple-linear59{ background: linear-gradient(#663300,#FF9933);}
    .simple-linear60{ background: linear-gradient(#FF9933,#FFFF66);}
    .simple-linear61{ background: linear-gradient(#FFFF66,#990066);}
    .simple-linear62{ background: linear-gradient(#990066,#FFCC00);}
    .simple-linear63{ background: linear-gradient(#FFCC00,#CC0033);}
    .simple-linear64{ background: linear-gradient(#CC0033,#FFCC33);}
    .simple-linear65{ background: linear-gradient(#FFCC33,#333399);}
    .simple-linear66{ background: linear-gradient(#333399,#FF0033);}
    .simple-linear67{ background: linear-gradient(#FF0033,#666699);}
    .simple-linear68{ background: linear-gradient(#666699,#FFFF00);}
    .simple-linear69{ background: linear-gradient(#FFFF00,#CC3366);}
    .simple-linear70{ background: linear-gradient(#CC3366,#FF0033);}
    .simple-linear71{ background: linear-gradient(#FF0033,#006699);}
    .simple-linear72{ background: linear-gradient(#006699,#FFFF33);}
    .simple-linear73{ background: linear-gradient(#FFFF33,#FFCC00);}
    .simple-linear74{ background: linear-gradient(#FFCC00,#009999);}
    .simple-linear75{ background: linear-gradient(#009999,#CC3366);}
    .simple-linear76{ background: linear-gradient(#CC3366,#FF0033);}
    .simple-linear77{ background: linear-gradient(#FF0033,#CCCC00);}
    .simple-linear78{ background: linear-gradient(#CCCC00,#006699);}
    .simple-linear79{ background: linear-gradient(#006699,#CCCC00);}
    .simple-linear80{ background: linear-gradient(#CCCC00,#FF9933);}
    .simple-linear81{ background: linear-gradient(#FF9933,#663399);}
    .simple-linear82{ background: linear-gradient(#663399,#FF9933);}
    .simple-linear83{ background: linear-gradient(#FF9933,#FFFF00);}
    .simple-linear84{ background: linear-gradient(#FFFF00,#336699);}
    .simple-linear85{ background: linear-gradient(#336699,#CC3333);}
    .simple-linear86{ background: linear-gradient(#CC3333,#FFCCCC);}
    .simple-linear87{ background: linear-gradient(#FFCCCC,#99CC00);}
    .simple-linear88{ background: linear-gradient(#99CC00,#003399);}
    .simple-linear89{ background: linear-gradient(#003399,#FFFF00);}
    .simple-linear90{ background: linear-gradient(#FFFF00,#FF6600);}
    .simple-linear91{ background: linear-gradient(#FF6600,#FFCC99);}
    .simple-linear92{ background: linear-gradient(#FFCC99,#FFFF99);}
    .simple-linear93{ background: linear-gradient(#FFFF99,#99CC99);}
    .simple-linear94{ background: linear-gradient(#99CC99,#FFCC99);}
    .simple-linear95{ background: linear-gradient(#FFCC99,#CCFF99);}
    .simple-linear96{ background: linear-gradient(#CCFF99,#CCCCCC);}
    .simple-linear97{ background: linear-gradient(#CCCCCC,#FFCC99);}
    .simple-linear98{ background: linear-gradient(#FFCC99,#FFFFCC);}
    .simple-linear99{ background: linear-gradient(#FFFFCC,#99CCFF);}
    .simple-linear100{ background: linear-gradient(#99CCFF,#FF9966);}
    .simple-linear101{ background: linear-gradient(#FF9966,#FFFFCC);}
    .simple-linear102{ background: linear-gradient(#FFFFCC,#99CC99);}
    .simple-linear103{ background: linear-gradient(#99CC99,#FF9900);}
    .simple-linear104{ background: linear-gradient(#FF9900,#FFFFCC);}
    .simple-linear105{ background: linear-gradient(#FFFFCC,#336699);}
    .simple-linear106{ background: linear-gradient(#336699,#CCCC33);}
    .simple-linear107{ background: linear-gradient(#CCCC33,#FFFF99);}
    .simple-linear108{ background: linear-gradient(#FFFF99,#CC9933);}
    .simple-linear109{ background: linear-gradient(#CC9933,#996600);}
    .simple-linear110{ background: linear-gradient(#996600,#FFCC33);}
    .simple-linear111{ background: linear-gradient(#FFCC33,#FF9900);}
    .simple-linear112{ background: linear-gradient(#FF9900,#FFFFCC);}
    .simple-linear113{ background: linear-gradient(#FFFFCC,#CC9933);}
    .simple-linear114{ background: linear-gradient(#CC9933,#FF6666);}
    .simple-linear115{ background: linear-gradient(#FF6666,#FF9900);}
    .simple-linear116{ background: linear-gradient(#FF9900,#FFFF00);}
    .simple-linear117{ background: linear-gradient(#FFFF00,#0099CC);}
    .simple-linear118{ background: linear-gradient(#0099CC,#99CC33);}
    .simple-linear119{ background: linear-gradient(#99CC33,#FF9900);}
    .simple-linear120{ background: linear-gradient(#FF9900,#FFCC00);}
    .simple-linear121{ background: linear-gradient(#FFCC00,#FF9933);}
    .simple-linear122{ background: linear-gradient(#FF9933,#99CC33);}
    .simple-linear123{ background: linear-gradient(#99CC33,#CC6699);}
    .simple-linear124{ background: linear-gradient(#CC6699,#FF9933);}
    .simple-linear125{ background: linear-gradient(#FF9933,#FFFF00);}
    .simple-linear126{ background: linear-gradient(#FFFF00,#3366CC);}
    .simple-linear127{ background: linear-gradient(#3366CC,#FF9933);}
    .simple-linear128{ background: linear-gradient(#FF9933,#FFFFCC);}
    .simple-linear129{ background: linear-gradient(#FFFFCC,#009966);}
    .simple-linear130{ background: linear-gradient(#009966,#FF6600);}
    .simple-linear131{ background: linear-gradient(#FF6600,#FFFF66);}
    .simple-linear132{ background: linear-gradient(#FFFF66,#009966);}
    .simple-linear133{ background: linear-gradient(#009966,#990033);}
    .simple-linear134{ background: linear-gradient(#990033,#CCFF66);}
    .simple-linear135{ background: linear-gradient(#CCFF66,#FF9900);}
    .simple-linear136{ background: linear-gradient(#FF9900,#FF9966);}
    .simple-linear137{ background: linear-gradient(#FF9966,#996600);}
    .simple-linear138{ background: linear-gradient(#996600,#CCCC00);}
    .simple-linear139{ background: linear-gradient(#CCCC00,#CC6600);}
    .simple-linear140{ background: linear-gradient(#CC6600,#999999);}
    .simple-linear141{ background: linear-gradient(#999999,#CCCC33);}
    .simple-linear142{ background: linear-gradient(#CCCC33,#CC6600);}
    .simple-linear143{ background: linear-gradient(#CC6600,#CCCC33);}
    .simple-linear144{ background: linear-gradient(#CCCC33,#336699);}
    .simple-linear145{ background: linear-gradient(#336699,#000000);}
    .simple-linear146{ background: linear-gradient(#000000,#FF9933);}
    .simple-linear147{ background: linear-gradient(#FF9933,#999966);}
    .simple-linear148{ background: linear-gradient(#999966,#663300);}
    .simple-linear149{ background: linear-gradient(#663300,#FF9933);}
    .simple-linear150{ background: linear-gradient(#FF9933,#FFFF66);}
    </style>'''
    data = style + data
    path = os.getcwd()
    file = open(path+"/snake.html","w")
    file.write(data)
    print('写入文件成功')
    

    2、后面的企鹅动画

    小企鹅的动画用的是cv2计算机视觉插件,获取将视频转成视频帧,解析成字符

    import os
    import sys
    import numpy
    import cv2  # 读取视频 计算机视觉
    
    gray_num = list("▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫      ")
    
    
    def main(videoPath: str):
        # 1、获取视频 2、获取视频帧 3、循环处理视频帧 4、将图片解析成字符
        # 输出
        data = ""
        cap = cv2.VideoCapture(videoPath)  # 读取视频
    
        while True:
            success, frame = cap.read()  # 读取视频帧
            if not success:
                break
            # 转换灰度图
            grayFrame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
            # 调整尺寸
            tsize = os.get_terminal_size()
            fixFrame = cv2.resize(grayFrame, (tsize.columns, int(tsize.lines)))
            img_array = numpy.array(fixFrame, "f")
            asciiFrame = ""
            for line in img_array:
                row = ""
                blank = 0
                flag = 0 
                for p in line:
                    # p 浮点数数字
                    n = (p/255)*(len(gray_num)-1)  # 灰度像素在字符列表中的位置
                    index = int(n)  # 转换为整数
                    text = gray_num[index]
                    #如果碰到非空白像素,flag+1
                    if text != " ":
                        flag += 1
                        if flag == 1:
                            row = row + "<span style='font-size:18px;line-height:1pt'>" + "&nbsp;"*blank + "</span>"
                            blank = 0
                        row += text
                    else:
                        flag = 0
                        blank += 1
                asciiFrame = asciiFrame + "<p style='font-size:1.0pt;'>" + row[:-1] + "</p>" + "\n"  # 字符画帧换行
            print(asciiFrame)  # 输出
            data = data + "<div style='height:719px;'>" + asciiFrame + "</div>"
        cap.release()
        path = os.getcwd()
        file = open(path+"/txt.html","w")
        file.write(data)
        print('写入文件成功')
    
    
    if __name__ == "__main__":
        if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
            main(sys.argv[1])
        else:
            print("No File")
    

    3、屏幕自动下滑代码

    import pyautogui
    
    while(1):
    	# 负值为向下滚动,正值向上滚动,如果视觉往下走,就是有点慢,应该加点数值
    	# 企鹅速度
    	pyautogui.scroll(-18)
    	# 效果1丝带速度
    	# pyautogui.scroll(-11)
    

    视频中的字符动画的文档和代码我都放到下面链接中了,大家想要做类似视频的话可以参考~~

    链接:
    https://pan.baidu.com/s/10fUIkXkq8d1S8RcuTafnFQ
    密码:9cca

    展开全文
  • Python 导出导入安装包

    2019-11-21 16:45:56
    python导出安装包 pip freeze > requirements.txt python导入安装包 pip install -r requirements.txt
  • Python 导出EXCEL

    2017-08-18 13:21:19
    Python 导出Excel exportExcel.py #! /usr/bin/python #! -*- coding: utf-8 -*- __auther__ = 'xiaoshenge' import datetime,time import sys import MySQLdb import xlrd import xlwt import calendar import ...
  • python导出excel文件

    2020-11-27 11:47:45
    python导出excel文件 一、list导出 import xlwt def test(): data = ... # data调用返回一个List的函数 count = 0 workbook = xlwt.Workbook() sheet = workbook.add_sheet('Sheet1') for row in data: str1...
  • 主要介绍了python导出hive数据表的schema实例代码,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下
  • python导出chrome书签到markdown文件,主要就是解析chrome的bookmarks文件,然后拼接成markdown格式的字符串,最后输出到文件即可。
  • Python导出项目依赖包

    2021-01-02 15:17:20
    Python导出项目依赖包 前言 Hey,大家好呀,我是码农,星期八 再使用Python开发项目时,通常我们需要安装很多第三方包 但是如果硬迁移,不考虑依赖有哪些第三方包,我想一定是头疼的,尤其是部署的时候 别慌,Python大佬早就...
  • Python导出.exe文件

    2021-03-25 15:55:17
    Python导出需要用到pyinstaller库 pyinstaller安装指令: pip install pyinstaller 安装完成以后注意pyinstaller第三方库安装到那个Python版本环境下。 当系统存在多版本Python时,需要注意编译程序使用的版本和...
  • python导出项目依赖包

    千次阅读 2020-06-22 11:48:35
    python导出项目依赖包导出所有项目的依赖包只导出当前项目依赖包 导出所有项目的依赖包 命令:pip3 freeze > requirements.txt 只导出当前项目依赖包 1、安装pipreqs:pip install pipreqs 2、进入当前项目目录下...
  • python导出chrome书签到markdown文件,主要就是解析chrome的bookmarks文件,然后拼接成markdown格式的字符串,最后输出到文件即可。下面给大家分享实例代码,需要的朋友参考下
  • 主要介绍了Python导出数据到Excel可读取的CSV文件的方法,设计Python操作Excel的相关技巧,需要的朋友可以参考下
  • 通过python导出excel的文件到lua直接读取
  • 使用python导出hive表的数据文件到本地 1、创建要导出数据的临时表。 2、使用如下脚本来导出数据文件,并制定分隔符。 #-*-coding:utf-8 -*- # created by lisardon at 20190813 for export more than 20000 rows ...
  • 用于FusionExport的语言SDK,可通过Python导出图表和仪表板。 安装 要安装此Python软件包,请使用pip: pip install fusionexport 用法 要在您的项目中使用SDK,请执行以下操作: from fusionexport import ...
  • 使用python导出hive数据到excel中 # -*- coding: utf-8 -*- import os import sys import re import subprocess import xlwt import time def exec_shell(cmd): res = subprocess.Popen(cmd, shell=True, stdout=...
  • Python导出数据(CSV格式)

    万次阅读 2018-05-10 17:37:28
    Python导出csv数据to_csv(filePath,sep=",",index=TRUE,header=TRUE)sep分隔符,默认为逗号(“,”)index是否导出行序号,默认为TRUEheader是否导出列名,默认为TRUE从Tushare库获取股票数据,并导出...
  • Python导出Excel为Lua/Json/Xml实例教程(一):初识Python 相关链接: Python导出Excel为Lua/Json/Xml实例教程(一):初识Python Python导出Excel为Lua/Json/Xml实例教程(二):xlrd初体验 Python导出Excel为Lua/...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 10,232
精华内容 4,092
关键字:

python导出

python 订阅