0
收藏
微博
微信
复制链接

Python技术干货:实时翻译和Google搜素(附源码)

2022-05-21 10:17
986

随着5G的到来,让兴起的万物互联和人工智能有足够的市场需求,起始于上世纪的Python因其特点在以往颇受欢迎,随着互联巨头们入局人工智能领域,让原本火爆的Python,更加碾压其他编程语言,成为零基础进入IT行业的首选语言。

今天小编为小伙伴们搜索了两个Python鲜为人知的实用操作,分别是实时翻译和Google搜索,并附上源码,具体如下:

翻译

随着全球化趋势发展,我们不可避免地面对一个多语言的世界,为了理解不同的语言,我们需要一个语言放翻译器,而Python中的Translate库可以帮助做到这一点。

安装:

pip install translate

代码:

#import the library  

from translate import Translator

#specifying the language  

translator = Translator(to_lang="Hindi")

#typing the message

translation = translator.translate('Hello!!! Welcome to fanyi')

#print the translated message

print(translation)

Google搜索

工程师在项目开发中经常忙碌中,很少有时间打开浏览器搜索想要的问题答案,但我们可通过Python的Google库来搜索查询问题,无需手动打开浏览器。

安装:

pip install google

代码:

#import library  

from googlesearch import search

#write your query

query = "best course for python"

# displaying 10 results from the search

for i in search(query, tld="co.in", num=10, stop=10, pause=2):

    print(i)

#you will notice the 10 search results(website links) in the output.

登录后查看更多
0
评论 0
收藏
侵权举报
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表凡亿课堂立场。文章及其配图仅供工程师学习之用,如有内容图片侵权或者其他问题,请联系本站作侵删。

热门评论0

相关文章

开班信息