Update powerball.py
The power ball now displays in red.
This commit is contained in:
1 parent
b81e5051c0
commit
b1a65acbd0
1 file changed
+10
-6
+10
-6
@@ -1,12 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
# Description: CLI to Powerball.com (prints previous winning results)
|
||||
# Description: CLI to https://powerball.com (prints previous winning results)
|
||||
# Usage: python3 powerball.py
|
||||
# Author: Justin Oros
|
||||
# Source: https://github.com/JustinOros
|
||||
# Dependencies: pip install requests beautifulsoup4
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup as BS
|
||||
|
||||
# ANSI escape codes for text formatting
|
||||
RED = '\033[31m'
|
||||
RESET = '\033[0m'
|
||||
|
||||
# Perform an HTTP GET request to the Powerball website
|
||||
powerballUrl = 'https://www.powerball.com/previous-results?gc=powerball'
|
||||
r = requests.get(powerballUrl, verify=True)
|
||||
@@ -28,15 +33,14 @@ whiteballPos = powerballPos = 0
|
||||
|
||||
# Loop through previous Drawing Dates
|
||||
for date in drawingDates:
|
||||
|
||||
# Print Drawing Date
|
||||
print (date.text + ":", end=" ")
|
||||
print(date.text.strip() + ":", end=" ")
|
||||
|
||||
# Print 5 White Balls
|
||||
for i in range(0, 5):
|
||||
print (whiteballs[whiteballPos].text + ",", end=" ")
|
||||
print(whiteballs[whiteballPos].text.strip() + ",", end=" ")
|
||||
whiteballPos += 1
|
||||
|
||||
# Print 1 Power Ball
|
||||
print (powerballs[powerballPos].text)
|
||||
# Print 1 Power Ball in red
|
||||
print(RED + powerballs[powerballPos].text.strip() + RESET)
|
||||
powerballPos += 1
|
||||
Reference in new issue
Block a user