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
11 changes: 11 additions & 0 deletions lenzzz/0000/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from PIL import Image,ImageDraw,ImageFont

im = Image.open("pic.jpg")
x,y = im.size
font = ImageFont.truetype("verdana.ttf", x/3)
dr = ImageDraw.Draw(im)
dr.text((3*x/4,0),font=font,text="4",fill="#FF0000")
im.save("pictuer_has_number.jpg")



Binary file added lenzzz/0000/pic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lenzzz/0000/pictuer_has_number.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lenzzz/0000/verdana.ttf
Binary file not shown.
20 changes: 20 additions & 0 deletions lenzzz/0001/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from random import randint

def makeCode(length,number):
code = []
code_set = set(code)
code_map = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
limit = len(code_map)
while(len(code_set)<number):
this_code = ""
for i in range(length):
this_code += code_map[randint(0,limit-1)]
code.append(this_code)
code_set = set(code)

return code_set


if __name__ == '__main__':
for i in makeCode(30,200):
print i
32 changes: 32 additions & 0 deletions lenzzz/0002/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from random import randint
import MySQLdb
def makeCode(length,number):
code = []
code_set = set(code)
code_map = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
limit = len(code_map)
while(len(code_set)<number):
this_code = ""
for i in range(length):
this_code += code_map[randint(0,limit-1)]
code.append(this_code)
code_set = set(code)

return code_set

def insertDatebase(code):
db = MySQLdb.Connect("localhost","root","","pythonmysql")
cursor = db.cursor()
sql = """INSERT INTO my_practice
VALUES ('%s')""" % code
try:
cursor.execute(sql)
db.commit()
except:
db.rollback()
db.close()

if __name__ == '__main__':
codes = makeCode(20,200)
for code in codes:
insertDatebase(code)