Skip to content

Commit b3dfb1c

Browse files
committed
add 0014
1 parent 3b38204 commit b3dfb1c

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

llluiop/0014/student.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
3+
import xlwt3
4+
import json
5+
6+
7+
8+
9+
def loadData(filepath):
10+
f = open(filepath, "r")
11+
return json.load(f, encoding = "utf-8")
12+
13+
def writeDataToXls(data):
14+
xls = xlwt3.Workbook(encoding = "utf-8")
15+
sheet = xls.add_sheet("student")
16+
style = xlwt3.XFStyle()
17+
font = xlwt3.Font()
18+
font.name = 'ºÚÌå'
19+
20+
for i in range(len(data)):
21+
sheet.write(i, 0, i+1,style)
22+
json_data = data[str(i+1)]
23+
for j in range(len(json_data)):
24+
sheet.write(i,j+1,json_data[j],style)
25+
xls.save('student.xls')
26+
27+
28+
if __name__ == '__main__':
29+
data = loadData("student.txt")
30+
writeDataToXls(data)
31+
32+
33+
34+

llluiop/0014/student.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"1":["����",150,120,100],
3+
"2":["����",90,99,95],
4+
"3":["����",60,66,68]
5+
}

llluiop/0014/student.xls

5.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)