Last active
September 15, 2018 00:42
-
-
Save S1M0N38/46e4952a1389ffa4eee9cc8356c3ac7c to your computer and use it in GitHub Desktop.
wisdom dispenser π§ββοΈ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import random | |
try: | |
from urllib.request import urlopen | |
except ImportError: | |
from urllib2 import urlopen | |
url = 'https://raw.githubusercontent.com/AntJanus/programmers-proverbs/master/README.md' | |
response = urlopen(url) | |
html = response.read() | |
html = html.decode('utf-8') | |
proverbs = [] | |
for line in html.split('\n'): | |
if line.startswith('#### '): | |
proverbs.append(line[5:]) | |
proverb = random.choice(proverbs) | |
print('\n π {}\n'.format(proverb)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation
cd
git clone https://gist.github.com/46e4952a1389ffa4eee9cc8356c3ac7c.git proverbs
python $HOME/proverbs/proverbs.py
in your~/.bashrc