国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - Python - Python實現將Excel轉換成為image的方法

Python實現將Excel轉換成為image的方法

2021-04-12 00:12楊鑫newlfe Python

今天小編就為大家分享一篇Python實現將Excel轉換成為image的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

我的主要思路是:

Excel -> Html -> Image

代碼如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding:utf-8 -*-
__author__ = 'YangXin'
import sys
import pandas as pd
import codecs
import imgkit
reload(sys)
sys.setdefaultencoding('utf-8')
 
 
# ReportImage -> report convert include multiple sheets into pictures
class ReportImage:
 
 def __init__(self):
  pass
 
 # excel_html -> convert excel include multiple sheets into multiple html file
 # excel_file -> file
 # html_path -> path
 @staticmethod
 def excel_html(excel_file, html_path):
  html_list = []
  excel_obj = pd.ExcelFile(excel_file)
  sheet_list = excel_obj.sheet_names
  index = 0
  for i in sheet_list:
   html_file = html_path + i + ".html"
   excel_data = excel_obj.parse(excel_obj.sheet_names[index])
   with codecs.open(html_file, 'w', 'utf-8') as html:
    html.write(excel_data.to_html(header=True, index=True))
   html_list.append(html_file)
   index += 1
  return html_list
 
 # html_image -> convert htmls into pictures file
 # html_list -> list
 # image_path -> path
 @staticmethod
 def html_image(html_list, image_path):
  index = 0
  for i in html_list:
   img_obj = image_path + str(index) + ".png"
   with open(i, 'r') as html_file:
    imgkit.from_file(html_file, img_obj, options={"encoding":"UTF-8"})
   index += 1
 
 
if __name__ == '__main__':
 html_list = ReportImage.excel_html("/xxx.xlsx", "/yyy/")
 ReportImage.html_image(html_list, "/zzz/")

以上這篇Python實現將Excel轉換成為image的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持服務器之家。

原文鏈接:https://blog.csdn.net/u012965373/article/details/81273430

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 国产日韩欧美一区二区 | 精品国产91 | 国产色区 | 免费h | 日韩精品免费在线观看 | 国产福利在线播放 | 精品免费av | 日本在线小视频 | 亚洲第一成av人网站懂色 | 日本天堂在线 | 网站色| 亚洲天堂网站 | 日韩大片在线观看 | 人人射在线视频 | 久久久久久久久久久高潮 | 91中文在线 | 国产一区二区影院 | 午夜视频在线 | 一级黄色大片在线观看 | 超碰综合 | 一区二区三区日韩 | av在线官网| 欧美精品一区二区三区手机在线 | 狠狠天天 | 国产又色又爽又黄 | 国产精品亚洲综合 | 午夜www| 在线观看免费黄视频 | 国产免费色 | 最新国产一区二区 | 欧美日韩精品免费观看 | www成人精品 | 日本免费在线视频 | 亚洲国产精品成人女人久久久 | www.国产.com| 欧美日韩在线播放 | 在线91 | 成人a视频片观看免费 | 国产日韩视频 | 国产成年人电影在线观看 | 成人av免费|