Skip to content

Commit 6fe0cd3

Browse files
committed
12 changes
1 parent e9e9c04 commit 6fe0cd3

File tree

12 files changed

+95
-0
lines changed

12 files changed

+95
-0
lines changed

Silocean/0010/DejaVuSansMono.ttf

314 KB
Binary file not shown.

Silocean/0010/Result.jpg

3.61 KB
Loading

Silocean/0010/Test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
__author__ = 'Tracy'
2+
import Image,ImageDraw,ImageFont,ImageFilter
3+
import random
4+
5+
image = Image.new('RGB', (50*4, 50), (255,255,255))
6+
7+
font = ImageFont.truetype('DejaVuSansMono.ttf', 24)
8+
9+
draw = ImageDraw.Draw(image)
10+
11+
def randColor():
12+
return (random.randint(64,255), random.randint(64,255), random.randint(64,255))
13+
14+
def randColor2():
15+
return (random.randint(32,127), random.randint(32,127), random.randint(32,127))
16+
17+
def randChar():
18+
return chr(random.randint(65,90))
19+
20+
for x in range(50*4):
21+
for y in range(50):
22+
draw.point((x, y), randColor())
23+
24+
for x in range(4):
25+
draw.text((50*x+10, 10), randChar(), randColor2(), font)
26+
27+
image = image.filter(ImageFilter.BLUR)
28+
image.save('Result.jpg')
29+
image.show()

Silocean/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+
}

Silocean/0014/Test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
__author__ = 'Tracy'
2+
import xlwt
3+
4+
with open('Student.txt', 'r') as f:
5+
content = f.read()
6+
7+
dic = eval(content)
8+
9+
file = xlwt.Workbook()
10+
table = file.add_sheet('Test', cell_overwrite_ok=True)
11+
12+
13+
def deal(key, value):
14+
table.write(int(key) - 1, 0, key)
15+
for x in range(len(value)):
16+
table.write(int(key) - 1, x + 1, str(value[x]).decode('gbk'))
17+
18+
for key, value in dic.items():
19+
deal(key, value)
20+
21+
file.save('result.xls')

Silocean/0014/result.xls

5.5 KB
Binary file not shown.

Silocean/0015/Test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
__author__ = 'Tracy'
2+
import xlwt
3+
4+
with open('city.txt') as f:
5+
content = f.read()
6+
dic = eval(content)
7+
8+
file = xlwt.Workbook()
9+
table = file.add_sheet("Test", cell_overwrite_ok=True)
10+
11+
for k, v in dic.items():
12+
table.write(int(k)-1, 0, k)
13+
table.write(int(k)-1, 1, str(v).decode('gbk'))
14+
15+
file.save('result.xls')

Silocean/0015/city.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"1" : "�Ϻ�",
3+
"2" : "����",
4+
"3" : "�ɶ�"
5+
}

Silocean/0015/result.xls

5.5 KB
Binary file not shown.

Silocean/0016/Test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
__author__ = 'Tracy'
2+
import xlwt
3+
4+
with open('numbers.txt') as f:
5+
content = f.read()
6+
lists = eval(content)
7+
8+
file = xlwt.Workbook()
9+
table = file.add_sheet('Test',cell_overwrite_ok=True)
10+
11+
for row in range(len(lists)):
12+
for col in range(len(lists[row])):
13+
table.write(row, col, lists[row][col])
14+
15+
file.save('result.xls')

Silocean/0016/numbers.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
[1, 82, 65535],
3+
[20, 90, 13],
4+
[26, 809, 1024]
5+
]

Silocean/0016/result.xls

5.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)