(1) use * Draw numbers “520”
ncol=20 nrow=10 proposal=[0,1,2,3,4,5,9,17,
1+1*ncol,8+1*ncol,10+1*ncol,16+1*ncol,
18+1*ncol,1+2*ncol,11+2*ncol,15+2*ncol,19+2*ncol,
1+3*ncol,12+3*ncol,15+3*ncol,19+3*ncol,2+4*ncol,
12+4*ncol,15+4*ncol,19+4*ncol,3+5*ncol,11+5*ncol,
15+5*ncol,19+5*ncol,4+6*ncol,10+6*ncol,15+6*ncol,19+6*ncol,
3+7*ncol,9+7*ncol,15+7*ncol,19+7*ncol,2+8*ncol,8+8*ncol,16+8*ncol,
18+8*ncol,1+9*ncol,8+9*ncol,9+9*ncol,10+9*ncol,11+9*ncol, 12+9*ncol,17+9*ncol]
proposalStr ='' for i in range(1,ncol*nrow): if i in proposal:
proposalStr=proposalStr+'*' else: proposalStr = proposalStr + ' ' if i%20==0:
proposalStr=proposalStr+'\r\n' print(proposalStr)

 

(2) Draw numbers with pictures of girlfriends “520”
from PIL import Image import os path="D:/ Photo /duxiaoxue"
#duxiaoxue Name of the document where the photo is stored ,50 Zhang Zuo canvasImage=Image.new('RGBA',(2000,1000)) ncol=20
nrow=10
proposal=[0,1,2,3,4,5,9,17,1+1*ncol,8+1*ncol,10+1*ncol,16+1*ncol,18+1*ncol,1+2*ncol,11+2*ncol,15+2*ncol,19+2*ncol,1+3*ncol,12+3*ncol,15+3*ncol,19+3*ncol,2+4*ncol,12+4*ncol,15+4*ncol,19+4*ncol,3+5*ncol,11+5*ncol,15+5*ncol,19+5*ncol,4+6*ncol,10+6*ncol,15+6*ncol,19+6*ncol,3+7*ncol,9+7*ncol,15+7*ncol,19+7*ncol,2+8*ncol,8+8*ncol,16+8*ncol,18+8*ncol,1+9*ncol,8+9*ncol,9+9*ncol,10+9*ncol,11+9*ncol,12+9*ncol,17+9*ncol]
listPic=[] for i in os.walk(path): listPic.append(i) k=0 for j in range(1,
200): # The choice here is 200, When the number of photos in the document is small , Will report an error if j in proposal: orgImage =
Image.open(os.path.join(path,listPic[0][2][k])) print(orgImage) canvasRow = j %
20; canvasCol = int((j - canvasRow) / 20); print(canvasRow) print(canvasCol)
print() orgImage = orgImage.resize((100, 100), Image.ANTIALIAS)
canvasImage.paste(orgImage, (canvasRow * 100, canvasCol * 100)) k=k+1
canvasImage.save('D:/duxiaoxue.bmp')
 

And then D The name found in the disk is “duxiaoxue” Of bmp file , Open as follows :

 

 

 

Technology
©2019-2020 Toolsou All rights reserved,
JS How to operate C Language console games , Make bricks use Python Do automated testing (pytest The essence of framework ) First knowledge MySQL Comprehensive review ( dried food )Python+OpenCV Detailed explanation of face recognition technology Baidu , Ali , Tencent's internal position level and salary structure , With job suggestions ! Image explanation of over fitting and under fitting Huawei certification HCIA-AI artificial intelligence New York Youth Project “ Recapture Wall Street ”: Safeguarding the interests of retail investors CSS architecture design