PyJokes is a Python library that provides one-liner jokes, primarily focusing on programmer humor. It also supports general and neutral joke categories, and multiple languages. Currently at version 0.8.3, it maintains a stable API with infrequent but consistent updates.
pip install pyjokesVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to fetch a single joke by category and language using `pyjokes.get_joke()`. It also shows how to handle potential issues if a specific language/category combination is unavailable.
Use supported categories like 'programmer', 'neutral', or 'all'. You can inspect `pyjokes.CATEGORIES` for a definitive list of current options.
Verify the returned joke's content, or explicitly check `pyjokes.LANGUAGES` and `pyjokes.CATEGORIES` for supported options before making a request to ensure you get the desired joke type.
Ensure you are using the correct function for your desired output. Use `get_joke()` for a single string, or `get_jokes()` if you intend to iterate over multiple jokes. Example: `for joke in pyjokes.get_jokes(): print(joke)`.
Install the package using pip: `pip install pyjokes`
Use one of the currently supported categories: 'programmer', 'neutral', or 'all'. You can check `pyjokes.CATEGORIES` for a definitive list.
Iterate over the list to process each joke string, or use `pyjokes.get_joke()` if you only need a single joke. Example: `for joke in pyjokes.get_jokes(): print(joke.strip())`
No dependency data recorded yet.