This is the fifth day of my participation in the Novembermore Challenge.The final text challenge in 2021

preface

Learning Python recently, I found many interesting modules. It feels like a whole new world opens up, because I’m not familiar with all the modules, so it’s not code today.

1, ItChat

This is an automatic reply module on wechat. Since I have been unable to log in on wechat, I have not tested the function of this module. Here is just a brief introduction.

The usage process is roughly as follows:

  1. Landing WeChat
  2. Register to monitor
  3. Response to monitor
  4. The end of the

And I was stuck in the login wechat above, the registration monitoring code is very simple. It can listen to a variety of data, text, pictures, videos and so on… It’s also very functional. You can also call the Turing robot API use (but Turing robot is charged), so that their wechat into an intelligent small robot. The use of specific can see blog: www.cnblogs.com/dongxiaodon… .

2, WordCloud

I think you’ve all seen pictures like this:It’s a bunch of keywords that form an image, some rectangular, some special shapes. And that’s what WordCloud does. This module is also very easy to use, we need to prepare a text, an image (PNG), and fill in a bunch of parameters.It’s cool, but it’s a web map. You can try to make your own pictures. For specific use, see:www.cnblogs.com/jlutiger/p/…

3, Pillow

This is a picture processing module, complete functions. We can use it to convert formats, crop images, splice images, rotate images, Gaussian blur, color channel separation/merge, and of course, it is much more difficult than photoshop software. But I like this module, and I’m going to do something with it soon. Here is the result:

4, Pygame

This is a graphical interface development module, but I’ve only scratched the surface. I haven’t learned much, so I don’t know how it differs from the Tkinter module.

There are also many interesting modules, such as matplotlib for ICONS, Pandas for Excel, Jieba for text, and so on. You can learn more about some modules by yourself, which can greatly reduce the workload of programming.

Updated in 2019, November, and March


5, wxpy

This is also used to develop wechat robot module, a module built on itChat. It’s very simple to use, just a few lines of code to implement the reply function:

from wxpy import *

bot = Bot(cache_path=True)
my_friend = bot.friends().search('Zacks', sex=MALE, city="Nanchang") [0]
my_friend.send('Hello WeChat! ')
Copy the code

But I still can not login wechat, with my classmates wechat to do a small experiment. It feels very convenient. I met a problem in the process of using it, and it took me a long time to find a solution on the Internet. (you probably won’t have the same problem as me), run the following exception:

OSError: [WinError 1155] No application is associated with the specified file for this operation. :'QR.png'
Copy the code

I never thought, is I do not have the software to view the picture. The problem was solved after I downloaded an “iQiyi Universal Player” (I really didn’t advertise).

6, pynput

This is a module to operate the mouse and keyboard, very simple to use. Its main modules are Mouse and keyboard. The keyboard and mouse. The operation is very simple, here is an example code to show you:

from pynput import *

Create a mouse
my_mouse = mouse.Controller()
Create a keyboard
my_keyboard = keyboard.Controller()

Move the mouse pointer to the specified position
my_mouse.position = (100.100)
# Click the left mouse button
my_mouse.click(mouse.Button.left)

# Type on a keyboard
my_keyboard.type('zack')
Copy the code

I haven’t done anything fun with this module yet. In addition, I have recently used WordCloud, and also wrote a blog about WordCloud “WordCloud generates kakashi ninjutsu WordCloud”, hoping to help you.