For this, you need to install the itchat third-party module
Just install it with pip pip install itchat
import itchat
import time #Introduce
the time function for testing
time_format='%Y-%d-%m %X'
time_current=time.strftime(time_format)
#itchat.auto_login()#python login Scan QR code Required for each login Generate QR code
itchat.auto_login(hotReload = True) #Do you need to scan after the first scan? To be tested
users=itchat.search_friends("Wang Haowen")
userName= users[0]['UserName']
itchat.send('Hello Wang Haowen,now is %s'%time_current,toUserName=userName)