forked from prathimacode-hub/Awesome_Python_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjokes_automation.py
32 lines (25 loc) · 1017 Bytes
/
jokes_automation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# install this library using pip install pyjokes
# then import the pyjokes library
import pyjokes
try:
print("Jokes for you-")
# to get a single joke
joke = pyjokes.get_joke()
print(joke)
# to get multiple jokes
jokes = pyjokes.get_jokes()
print(jokes)
# to get specific number of jokes
jokes = pyjokes.get_jokes()
for i in range(0, 5):
print(jokes[i], end="\n\n")
# to get a single joke in particular language, example es - Spanish
# category is for what type of jokes you want
joke_lang = pyjokes.get_joke(language="es", category="neutral")
print(joke_lang)
# to get multiple jokes in a particular language, example es - Spanish
# category is for what type of jokes you want
jokes_lang = pyjokes.get_jokes(language="es", category="neutral")
print(jokes_lang)
except Exception as e:
pass