Skip to content

Commit 5552f18

Browse files
committed
make it compliable
1 parent 2b4a466 commit 5552f18

4 files changed

Lines changed: 17 additions & 21 deletions

File tree

‎llluiop/0013/pictures.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def handle_starttag(self, tag, attrs):
2121
def Pic(picurls):
2222
count = 1
2323
for picurl in picurls:
24-
print picurl
2524
conn = urllib2.urlopen(picurl)
2625
f = open(str(count)+".jpg", 'wb')
2726
f.write(conn.read())

‎llluiop/0014/student.py‎

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
#!/usr/bin/env python
22

3-
import xlwt3
3+
import xlwt
44
import json
55

66

7-
8-
9-
def loadData(filepath):
7+
def load_data(filepath):
108
f = open(filepath, "r")
11-
return json.load(f, encoding = "utf-8")
9+
return json.load(f)
1210

13-
def writeDataToXls(data):
14-
xls = xlwt3.Workbook(encoding = "utf-8")
11+
def write_data_to_xls(data):
12+
xls = xlwt.Workbook()
1513
sheet = xls.add_sheet("student")
16-
style = xlwt3.XFStyle()
17-
font = xlwt3.Font()
18-
font.name = 'ºÚÌå'
14+
1915

2016
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')
17+
sheet.write(i, 0, i+1)
18+
json_data = data[str(i+1)]
19+
for j in range(len(json_data)):
20+
sheet.write(i, j+1, json_data[j])
21+
22+
xls.save('student.xls')
2623

2724

2825
if __name__ == '__main__':
29-
data = loadData("student.txt")
30-
writeDataToXls(data)
26+
data = load_data("student.txt")
27+
write_data_to_xls(data)
3128

3229

3330

‎llluiop/0014/student.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"1":["����",150,120,100],
3-
"2":["����",90,99,95],
4-
"3":["����",60,66,68]
2+
"1":["张三",150,120,100],
3+
"2":["李四",90,99,95],
4+
"3":["王五",60,66,68]
55
}

‎llluiop/0014/student.xls‎

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)