Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Jimmy66/0000/0000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from PIL import Image,ImageDraw,ImageFont

def addNum(filePath):
img = Image.open(filePath)
size = img.size
fontSize = size[1] / 4
draw = ImageDraw.Draw(img)

ttFont = ImageFont.truetype("/Library/Fonts/arial.ttf", fontSize)
draw.text((size[0]-fontSize, 0), "6",(256,0,0), font=ttFont)
del draw
img.save('./result.jpg')
img.show()


if __name__ == '__main__':
addNum("image.jpg")
Binary file added Jimmy66/0000/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Jimmy66/0001/0001.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python

import random
import os

def radom_generate():
string = ''
for n in range(1,9):
number = int(random.uniform(0,9))
string += str(number)
string += '\n'
return string

def file_write():
fp = open("result.txt",'ab')
string = radom_generate()
fp.write(string)
fp.close()

if __name__ == '__main__':
for n in range(1,201):
file_write()
200 changes: 200 additions & 0 deletions Jimmy66/0001/result.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
06221205
85531344
10747373
40887544
61712875
83813324
43648825
30840323
36832211
01105618
13410375
65468385
55683113
68867155
24545317
64626102
20728343
06812487
46831163
43211742
74116167
84722574
42777526
06821521
46006164
75747227
01811788
25124141
88402648
27814287
71176283
34852241
13232158
55172318
76560208
34562718
14470566
66472235
43043486
82587857
31165481
61282076
51888112
63434568
00332440
16208350
82726762
76348604
67626647
40874847
32004853
23201687
76141208
76652005
43027814
70487088
51100542
75636082
11274755
68062563
47757087
88845773
27218807
02881740
80688110
62527342
88376682
52136864
32768130
64831121
01660656
68284636
03844432
53287038
33517722
78753670
72513462
80243861
80740322
32666043
14767271
31362170
54722211
67673546
71530765
30244212
77576738
86657202
84444178
88468247
54184117
56661765
84005730
08121831
27275157
57340616
10544260
22873056
78722771
11734138
73146352
20243567
10067846
18647840
36105120
10127745
34721127
78540741
50541616
32316886
17477764
68557540
61833782
14836884
13205258
30135127
06784272
06035717
57765256
16304861
35258452
06857838
65270618
81846635
81831780
37150676
83437771
52254508
42765761
13213803
58634373
80018333
80162586
34380717
65865270
08286300
24416804
44766425
21210230
16060305
55578384
01312373
41407715
76451227
47103278
60401033
33811504
58456258
03256286
08403105
64435036
51277430
74503246
40023773
24817724
88612034
07788457
86656864
72513618
05212708
25161048
18440578
28626680
21455352
18247878
56710751
40024360
02676631
71176541
45347211
72637627
30713084
71061801
54546710
73405660
70303522
26720541
62457276
43350522
66346162
36376106
86125656
22880566
16325646
88307733
08081038
48314863
40044423
87133380
88580362
84376574
41720582
53641143
55035648
72176747
32600634
57622861
46441808
51540837
65628570
28 changes: 28 additions & 0 deletions Jimmy66/0002/0002.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import mysql.connector

#从文件中读取信息
def file_read(filename):
with open(filename,'r') as f:
lines = f.readlines()
for n in range(0,200):
lines[n] = lines[n].strip()
return lines

#存入数据库
def mysql_write():
lines = file_read('result.txt')
conn = mysql.connector.connect(user='root', password='password', database='test', use_unicode=True) #密码自行修改为自用密码
cursor = conn.cursor()
cursor.execute('create table promo_code (id int(3) primary key, number varchar(8))')
for n in range(0,200):
cursor.execute('insert into promo_code (id, number) values (%s, %s)', [n+1, lines[n]])
conn.commit()
cursor.close()
conn.close()
print "finish"

if __name__ == '__main__':
mysql_write()
Loading