current position:Home>Several very interesting modules in Python

Several very interesting modules in Python

2022-02-01 01:03:59 ZackSock

This is my participation 11 The fourth of the yuegengwen challenge 5 God , Check out the activity details :2021 One last more challenge

Preface

Recent learning Python, Found many interesting modules . It feels like opening the door to a new world , Because I am not familiar with all modules , So today is not about code .

1、ItChat

This is a wechat automatic reply module , Because I can't log in to wechat , So I didn't test the function of this module . This is just a brief introduction .

The use process is roughly :

  1. Log in wechat
  2. Register to listen
  3. Response monitoring
  4. end

And I'm stuck on logging in to wechat , If you register to listen, the code is also very simple . It can monitor a variety of data , written words 、 picture 、 Video etc. ... The functions are also very complete . You can also call the Turing robot's API Use ( But Turing robots are paid ), Turn your wechat into an intelligent little robot . See the blog for specific usage :www.cnblogs.com/dongxiaodon….

2、WordCloud

I think everyone should have seen this style of pictures :  Insert picture description here Is a lot of keywords to form a picture , Some are rectangles, some are special shapes . and WordCloud The role of , Is to make this kind of picture . The use of this module is also very convenient , We need to prepare a text 、 A picture (PNG Of )、 Then fill in a bunch of parameters .  Insert picture description here It's really handsome , But this is a network diagram . You can try to make your own favorite pictures . Please refer to :www.cnblogs.com/jlutiger/p/…

3、Pillow

This is a picture processing module , The function is all ready . We can use it to convert the format 、 Cut the picture 、 Mosaic picture 、 Rotate the picture 、 Gaussian blur 、 Color channel separation / Merge 、、、 Yes, of course , Than p Graphics software is much more troublesome . But I still like this module , I also plan to use this module to make some small things recently . Let's see the effect :  Insert picture description here

4、Pygame

This is a graphical interface development module , But I just touched . Didn't learn much , So I don't know much about it and tkinter Module differences .

In addition, there are many interesting modules , Like dealing with icons matplotlib、 Handle Excel Of pandas、 Dealing with text Jieba etc. . You can learn more about some modules by yourself , It can greatly reduce the workload of programming .

2019、11、3 to update


5、wxpy

This module is also used to develop wechat robot , Based on itchat A module above . It's very simple to use , The following lines of code can realize the reply function :

from wxpy import *

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

But I still can't log in to wechat , I did a small experiment with my classmate's wechat . It feels very convenient . In the process of using, I encountered a problem , I've been looking for it on the Internet for a long time and haven't solved it .( You shouldn't have the same problem as me ), The following exceptions are reported during the operation :

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

I didn't expect , I don't have software to view pictures . In my next “ Iqiyi universal player ” After the problem is solved ( I really didn't advertise ).

6、pynput

This is a module for operating the mouse and keyboard , It's very simple to use . Its main modules are mouse、keyboard. Keyboard and mouse . The operation is very simple , Let's show you an example code :

from pynput import *

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

#  Move the mouse to the specified position 
my_mouse.position = (100, 100)
#  Left click 
my_mouse.click(mouse.Button.left)

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

But I haven't used this module to make anything fun yet . In addition, recently used word cloud , I also wrote a blog about word cloud 《WordCloud Generate Kakashi Ninja word cloud 》 I hope I can help you .

copyright notice
author[ZackSock],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/02/202202010103558710.html

Random recommended