Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to solve the problem that the PyKeyboard plug-in in Python3.6 cannot input Chinese characters

Shulou Source: shulou.com Published: 2022-06-01 17:41:30 10月01日 Update

This article shows you how to solve the problem that the PyKeyboard plug-in in Python3.6 can not enter Chinese characters. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Today, when writing keyword search and collection based on Wechat PC, we can input letters and numbers into the search box through PyKeyboard's type_string method, but Chinese characters can not be entered all the time. It was later discovered that PyKeyboard had a flaw in Python3.6. The solution is as follows:

Step 1: install the plug-in: pip install pyperclip step 2: use the plug-in's copy () method to copy Chinese characters to the clipboard: pyperclip.copy ("Chinese") step 3: use the mouse in the input state Step 4: simulate keyboard click ctrl+v the complete code is as follows: import pyperclip import timefrom pykeyboard import PyKeyboardpyperclip.copy ("Chinese") time.sleep (2) # pyperclip.paste () k = PyKeyboard () # Simulation keyboard click ctrl+v to achieve string copy function k.press_key (k.control_key) k.tap_key ('v') k.release_key (k.control_key) # at this time Chinese characters have been copied to the input box ^ _ ^ the above content is how to solve the problem that the PyKeyboard plug-in in Python3.6 can not input Chinese characters, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Input plug-ins Chinese characters characters methods Chinese characters questions content skills knowledge keyboard search concise concise code keys keywords functions letters strings Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi macOS OPPO Reno Docker