Randfacts is a Python module that generates random facts.
There are thousands of facts built in.
Installation
pip install randfacts
Examples
import randfacts fact = randfacts.get_fact() print(fact)
When you run this you should see something like this, a random fact
The human brain cannot feel pain.
This package has a filter option to filter out potentially inappropriate facts. The filter is on by default. To disable the filter, you can just set the filter_enabled
parameter to False
.
import randfacts fact = randfacts.get_fact() print(fact) filtered_fact = randfacts.get_fact(filter_enabled=False) print(filtered_fact)
Running this I saw this
Medieval chastity belts are a myth. A great majority of examples now existing were made in the 18th and 19th centuries as jokes.
The catfish has over 27,000 taste buds.
If you want to access the list of facts directly, you can just import the safe_facts
, unsafe_facts
, or all_facts
lists from the randfacts module.