I believe wechat can't be used more . that , about python+ WeChat , What new tricks can we play ? Now I'll bring you a funny thing . use python Download the avatars of all wechat friends , And then put it together into a big picture . such , You can reprint it to the circle of friends XY 了 . ha-ha .
Let's first show you the renderings . After all, there is no plan X.
All right, no more nonsense , Let's see how we do it step by step .
Download wechat friend avatar
The first step, of course, is to download the avatar of wechat friends , Before splicing . Here we use itchat This python The library of . About this library , We will launch more interesting things later , Please pay attention and Just look forward to it . Look at the code first :
The code is often simple . First we call itchat.auto_login() Log in via wechat .
After scanning the code and logging in successfully , We get friends again , Then get the avatar , Configure the file saving path again , Finally, write the avatar into the file . Is it incredibly simple ?
Splicing friends' avatars
Splicing we used PIL In the library Image modular . See the code below :
Let's start with os.listdir The path to get all the avatars is saved to pathList Inside . Then create a big picture , Divide the big picture into n A small square , Then put the picture of your friend in the small square . It should be noted that , In front of your friend's Avatar , The avatar needs to be shortened to fit . Last , Generate final file . You can find it in the current directory final.jpg. That is our finished product . You can take it to the circle of friends to force ~
Learn from good examples Python Whether it's employment or sideline, it's good to make money , But learn to Python Still have a learning plan . Finally, let's share a complete set of Python Learning materials , For those who want to learn Python Let's have a little help !
Python All directions are Python Sort out the common technical points , Form a summary of knowledge points in various fields , The use of it is , You can find the corresponding learning resources according to the above knowledge points , Make sure you learn more comprehensively .
If a worker wants to do a good job, he must sharpen his tools first . Study Python Common development software is here , It saves you a lot of time .
When we were watching videos to learn , You can't just move your eyes and brain without hands , A more scientific way to learn is to use them after understanding , At this time, the hand training program is very suitable .
Optical theory is useless , Learn to knock together , Do it , Can you apply what you have learned to practice , At this time, we can make some practical cases to learn .
We learn Python Must be to find a well paid job , The following interview questions are from Ali 、 tencent 、 The latest interview materials of big Internet companies such as byte , And the leader Ali gave an authoritative answer , After brushing this set of interview materials, I believe everyone can find a satisfactory job .
Guarantee 100% free
】