Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize Fast Command Line Translation of youdao Dictionary by python

Shulou Source: shulou.com Published: 2022-05-31 10:51:38 10月03日 Update

This article Xiaobian for you to introduce in detail "python how to achieve youdao dictionary command line fast translation", the content is detailed, the steps are clear, the details are handled properly, I hope this "python how to achieve youdao dictionary command line fast translation" article can help you solve your doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.

1. Prepare for

Before you begin, make sure that Python and pip are successfully installed on your computer. Oh, if not, please visit this article: hyperdetailed Python installation Guide for installation. If you use Python for data analysis, you can directly install Anaconda:Python data analysis and mining helper-Anaconda

Open Cmd (start-run-CMD) in Windows environment, and open Terminal (command+ space input Terminal) in Apple system environment, ready to start entering commands to install dependencies.

Of course, I recommend that you use the VSCode editor, Copy the code of this article, and install the dependency module by running commands in the terminal below the editor. What a comfortable thing: the best partner of Python programming-VSCode detailed guide.

Enter the following command at the terminal to install the dependent module we need:

Pip install youdao_dict

If you see Successfully installed xxx, the installation is successful.

two。 Use

When you come across a word that cannot be translated, just click on it in the editor below:

Youdao words you can't translate

For example, "slightly tipsy" in English:

Of course, it can also be translated from English into Chinese, such as standalone:

3. Source code analysis

The principle of this module is very simple, that is, it calls Youdao Translation's web version of API, which has the function of automatically detecting language:

Then different interpretations are crawled according to the HTML structure and its distribution of the page:

Read this, the "python how to achieve youdao dictionary command line fast translation" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.

Tags: Commands dictionaries articles modules editors analysis input success content guidelines data data analysis environment articles terminals vocabulary English preparation run different Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia Shulou Technology Microsoft vpn