Python

Python fun!

Posted on

Recently dove into Python and wanted to share the fun!   Playing with the Chuck Norris API and writing chuck quotes to a file: import requests URL = ‘https://api.chucknorris.io/jokes/random’ outFile = ‘chucknorris.html’ open(outFile, ‘w’).close() with open(outFile,’a’) as o: for i in range(1000): json_response = requests.get(URL).json() o.write(‘<h4>’ + json_response[‘value’] + ‘</h4>\n’) print(json_response[‘value’])   Surrounding each line […]