-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from io import BytesIO | ||
import xlwt | ||
|
||
# 将数据保存成excel | ||
def write_data(data, tname): | ||
file = xlwt.Workbook(encoding='utf-8') | ||
table = file.add_sheet(tname, cell_overwrite_ok=True) | ||
l = 0 | ||
for line in data: | ||
c = 0 | ||
for _ in line: | ||
table.write(l, c, line[c]) | ||
c += 1 | ||
l += 1 | ||
sio = BytesIO() | ||
file.save(sio) | ||
return sio | ||
|
||
|
||
# excel业务逻辑处理 | ||
def CreateTable(cursor, id): | ||
item = [] | ||
item.append(['任务状态', '域名', '网站标题', 'CMS识别结果', '其他信息']) | ||
for i in cursor: | ||
item.append(i) | ||
file = write_data(item, id) | ||
return file.getvalue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ requests==2.19.1 | |
six==1.11.0 | ||
urllib3==1.23 | ||
vine==1.1.4 | ||
xlwt==1.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters