(1) use * Draw numbers “520”
ncol=20 nrow=10 proposal=[0,1,2,3,4,5,9,17,
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
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

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




©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