大家好!本日给你们带来了Python随机诙谐短语天生库Pyjokes,可以随机天生英文诙谐短语。
安装:
pip install pyjokes
命令式利用:

pyjoke -c all
python实例:
import pyjokesi=1while i <=5: i=i+1 joke = pyjokes.get_joke() print(joke) print("")
输出:
The C language combines all the power of assembly language with all the ease-of-use of assembly language.To understand recursion you must first understand recursion.What do you call eight hobbits? A hobbyte.What does 'Emacs' stand for? 'Exclusively used by middle aged computer scientists.'How to explain the movie Inception to a programmer? When you run a VM inside another VM, inside another VM ... everything runs real slow!
利用translate 翻译成中文:
import pyjokesfrom translate import Translatori=1while i <=5: i=i+1 joke = pyjokes.get_joke() joke_cn = Translator(from_lang="en", to_lang="zh").translate(joke) print(joke_cn) print("")
输出:
探求精良的PHP开拓职员就像在大海捞针。还是针头上的黑客?如果你把一百万只猴子放在一百万个键盘上,个中一个终极会写一个Java程序。别的的人将编写Perl。布尔值的最好之处在于,纵然您错了,您也只错了一点点。得意洋洋地, Beth在2030年从她的做事器上删除了Python 2.7。“终于!
”她高兴地说,却看到了Python 4.4的公告。乐不雅观主义者:玻璃杯是半满的。悲观主义者:玻璃杯有一半是空的。程序员:玻璃杯是须要的两倍大。