initial creation
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ttps4850wa1205
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
python-dateutil
|
||||
lxml
|
||||
paramiko
|
||||
pylint
|
||||
requests
|
||||
cython
|
||||
numba
|
||||
pyqt5
|
||||
pytest
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
import pymysql
|
||||
|
||||
candidate = (
|
||||
'Nader', 'Ralph', 'Winstead', 'Connecticut', '1934-02-27', 'Independent'
|
||||
)
|
||||
|
||||
myconn = pymysql.connect(
|
||||
host="localhost",
|
||||
db="python2",
|
||||
user="scripts",
|
||||
passwd="scripts"
|
||||
)
|
||||
|
||||
c = myconn.cursor()
|
||||
|
||||
insert_stmt = '''
|
||||
INSERT INTO presidents
|
||||
(termnum, lastname, firstname, termstart, termend,
|
||||
birthplace, birthstate, birthdate, deathdate, party)
|
||||
VALUES
|
||||
(45, %s, %s, '2012-01-20', '2016-01-20',
|
||||
%s, %s, %s, NULL, %s);
|
||||
'''
|
||||
|
||||
rows = c.execute(insert_stmt, candidate)
|
||||
|
||||
if rows == 1:
|
||||
print("Record inserted OK.")
|
||||
myconn.commit()
|
||||
else:
|
||||
print("Error inserting record:")
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from random import choice
|
||||
from datetime import date
|
||||
import sqlite3
|
||||
|
||||
candidate_info = (
|
||||
46, 'Nader', 'Ralph', date(2017,1,20), date(2021,1,19),
|
||||
'Winstead', 'Connecticut',
|
||||
date(1934,2,27), None, 'Independent'
|
||||
)
|
||||
|
||||
with sqlite3.connect("../DATA/presidents.db") as conn:
|
||||
|
||||
c = conn.cursor()
|
||||
|
||||
insert_stmt = '''
|
||||
INSERT INTO presidents
|
||||
(termnum, lastname, firstname, termstart, termend,
|
||||
birthplace, birthstate, birthdate, deathdate, party)
|
||||
VALUES
|
||||
(?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?);
|
||||
'''
|
||||
|
||||
try:
|
||||
rows = c.execute(insert_stmt, candidate_info)
|
||||
except Exception as e:
|
||||
print("Error inserting record:", e)
|
||||
conn.rollback()
|
||||
else:
|
||||
print("Record inserted OK.")
|
||||
conn.commit()
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
# (c) 2018 CJ Associates
|
||||
#
|
||||
import os
|
||||
|
||||
all_lines_count = 0
|
||||
all_files_count = 0
|
||||
|
||||
for current_dir, dir_list, file_list in os.walk('..'): # start in parent of ANSWERS
|
||||
for file_name in file_list:
|
||||
if file_name.endswith('.py'):
|
||||
file_path = os.path.join(current_dir, file_name)
|
||||
with open(file_path) as file_in:
|
||||
try:
|
||||
file_lines_count = len(file_in.readlines())
|
||||
all_files_count += 1
|
||||
except Exception as err:
|
||||
print(err)
|
||||
print("FILE NAME WAS", file_path)
|
||||
all_lines_count += file_lines_count
|
||||
|
||||
print("There were {} total lines in {} Python files".format(all_lines_count, all_files_count))
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
if sys.platform == 'win32':
|
||||
DEST = r'\TEMP'
|
||||
else:
|
||||
DEST = '/tmp'
|
||||
|
||||
logging.basicConfig(
|
||||
filename='../TEMP/copying.log',
|
||||
level=logging.INFO,
|
||||
)
|
||||
|
||||
for dir_path, dir_list, file_list in os.walk('../DATA'):
|
||||
for file_name in file_list:
|
||||
if file_name.endswith('.txt'):
|
||||
full_name = os.path.join(dir_path, file_name)
|
||||
message = 'copying {} to {}'.format(full_name, DEST)
|
||||
print(message)
|
||||
logging.info(message)
|
||||
shutil.copy(full_name, DEST)
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 23:21:41 2013
|
||||
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
from collections import Counter
|
||||
|
||||
start_dir = sys.argv[1]
|
||||
|
||||
counter = Counter()
|
||||
|
||||
for curr_dir, dir_list, file_list in os.walk(start_dir):
|
||||
for file_name in file_list:
|
||||
if '.' in file_name:
|
||||
base, ext = os.path.splitext(file_name)
|
||||
counter[ext] += 1
|
||||
|
||||
for ext, count in counter.items():
|
||||
print(ext, count)
|
||||
print()
|
||||
|
||||
print(counter.most_common(10))
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
csv_read.py
|
||||
|
||||
@author: jstrick
|
||||
Created on Sun Mar 10 14:15:51 2013
|
||||
|
||||
"""
|
||||
import csv
|
||||
|
||||
with open('../DATA/presidents.csv') as presidents_in:
|
||||
rdr = csv.reader(presidents_in) # <1>
|
||||
for row in rdr: # <2>
|
||||
print('{:25s} {:12s} {}'.format(
|
||||
row[1],row[2], row[-1]
|
||||
))
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
with open("../DATA/mystery", "rb") as mystery_in:
|
||||
all_bytes = mystery_in.read()
|
||||
picture_bytes = all_bytes[0::3] # get every third byte
|
||||
print((picture_bytes.decode())) # decode from bytes to printable string
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# (c) 2018 CJ Associates
|
||||
#
|
||||
from functools import wraps
|
||||
|
||||
def double_return(old_func):
|
||||
|
||||
@wraps(old_func)
|
||||
def new_func(*args, **kwargs):
|
||||
result = old_func(*args, **kwargs)
|
||||
return result * 2
|
||||
|
||||
return new_func
|
||||
|
||||
|
||||
@double_return
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
|
||||
@double_return
|
||||
def bark():
|
||||
return "woof!"
|
||||
|
||||
|
||||
print(add(2, 2))
|
||||
print(add(1, 9))
|
||||
print(bark())
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
url = 'http://imgs.xkcd.com/comics/python.png'
|
||||
saved_pdf_file = 'xkcd.png'
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
except requests.HTTPError as err:
|
||||
print("Unable to open URL:", err)
|
||||
sys.exit(1)
|
||||
|
||||
if response.status_code == requests.codes.OK:
|
||||
with open(saved_pdf_file, 'wb') as xkcd_out:
|
||||
xkcd_out.write(response.content)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
from urllib.request import urlopen
|
||||
from urllib.error import HTTPError
|
||||
|
||||
url = 'http://imgs.xkcd.com/comics/python.png'
|
||||
saved_pdf_file = 'xkcd.png'
|
||||
|
||||
try:
|
||||
response = urlopen(url)
|
||||
except HTTPError as err:
|
||||
print("Unable to open URL:", err)
|
||||
sys.exit(1)
|
||||
|
||||
pdf_contents = response.read()
|
||||
response.close()
|
||||
|
||||
with open(saved_pdf_file, 'wb') as xkcd_out:
|
||||
xkcd_out.write(pdf_contents)
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 21:17:01 2013
|
||||
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
from datetime import datetime as DateTime
|
||||
|
||||
for filename in sys.argv[1:]:
|
||||
mtime = os.path.getmtime(filename)
|
||||
file_date = DateTime.fromtimestamp(mtime)
|
||||
fmt_date = DateTime.strftime(file_date,'%b %d, %Y')
|
||||
print("{0:15s} {1}".format(filename, fmt_date))
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
from multiprocessing.dummy import Pool
|
||||
import re
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
start_folder = sys.argv[1]
|
||||
file_paths = []
|
||||
for curr_dir, dir_list, file_list in os.walk(start_folder):
|
||||
for file_name in file_list:
|
||||
file_paths.append(os.path.join(curr_dir, file_name))
|
||||
|
||||
pool = Pool(64)
|
||||
results = pool.map(analyze_file, file_paths)
|
||||
total_files = len(file_paths)
|
||||
total_bytes = sum(r[0] for r in results)
|
||||
total_lines = sum(r[1] for r in results)
|
||||
print("Number of files:", total_files)
|
||||
print("Number of bytes:", total_bytes)
|
||||
print("Number of lines:", total_lines)
|
||||
|
||||
|
||||
|
||||
def analyze_file(file_path):
|
||||
with open(file_path, "rb") as file_in:
|
||||
contents = file_in.read()
|
||||
num_bytes = len(contents)
|
||||
num_lines = contents.count(b'\n')
|
||||
return num_bytes, num_lines
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Tue Mar 12 14:09:16 2013
|
||||
|
||||
"""
|
||||
from datetime import date as Date
|
||||
import calendar
|
||||
|
||||
test_dates = (
|
||||
(1956, 10, 31),
|
||||
(1952, 9, 22),
|
||||
(1990, 8, 27),
|
||||
)
|
||||
|
||||
for year, month, day in test_dates:
|
||||
dt = Date(year, month, day)
|
||||
wday = calendar.weekday(year, month, day)
|
||||
wday_name = calendar.day_name[wday]
|
||||
is_leapyear = calendar.isleap(year)
|
||||
print('{} {:10s} {}'.format(dt, wday_name, is_leapyear))
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
from PyQt5.QtWidgets import QMainWindow, QApplication
|
||||
from ui_gpresinfo import Ui_PresInfo
|
||||
|
||||
from president_sqlite import President
|
||||
|
||||
class PresInfoMain(QMainWindow):
|
||||
def __init__(self):
|
||||
QMainWindow.__init__(self)
|
||||
|
||||
# Set up the user interface from Designer.
|
||||
self.ui = Ui_PresInfo()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# Connect up menu actions
|
||||
self.ui.actionQuit.triggered.connect(self.close)
|
||||
|
||||
# Connect up the buttons.
|
||||
self.ui.btGetInfo.clicked.connect(self._get_info)
|
||||
|
||||
def _get_info(self):
|
||||
term_num = int(self.ui.leTermNum.text())
|
||||
p = President(term_num)
|
||||
name = '{} {}\n'.format(p.first_name, p.last_name)
|
||||
birth_location = '{}, {}\n'.format(p.birth_place, p.birth_state)
|
||||
birth = 'Born: {}\n'.format(p.birth_date)
|
||||
death = 'Died: {}\n'.format(p.death_date)
|
||||
served = 'Served: {} to {}\n'.format(p.term_start, p.term_end)
|
||||
party = '{}\n'.format(p.party)
|
||||
self.ui.pteInfo.clear()
|
||||
for field in name, birth_location, birth, death, served, party:
|
||||
self.ui.pteInfo.insertPlainText(field)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
main = PresInfoMain()
|
||||
main.show()
|
||||
sys.exit(app.exec_())
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PresInfo</class>
|
||||
<widget class="QMainWindow" name="PresInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>377</width>
|
||||
<height>309</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>President Info</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
<width>381</width>
|
||||
<height>261</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTermNum">
|
||||
<property name="text">
|
||||
<string>Enter Term Number:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leTermNum"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btGetInfo">
|
||||
<property name="text">
|
||||
<string>Get Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="pteInfo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>377</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFIle">
|
||||
<property name="title">
|
||||
<string>FIle</string>
|
||||
</property>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<addaction name="menuFIle"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionQuit">
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import json
|
||||
|
||||
with open('../DATA/presidents.json') as PRES:
|
||||
p = json.load(PRES)
|
||||
|
||||
for pres in p['presidents']:
|
||||
name = pres['lname'] + ', ' + pres['fname']
|
||||
state = pres['birthstate']
|
||||
print('{0:40s} {1:30s}'.format(name, state))
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Thu Mar 21 00:20:43 2013
|
||||
|
||||
"""
|
||||
import zipfile
|
||||
|
||||
zfile = zipfile.ZipFile('potus.zip','w')
|
||||
zfile.write('save_potus_info.py')
|
||||
zfile.write('read_potus_info.py')
|
||||
zfile.write('potus.pic')
|
||||
zfile.close()
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
directory = sys.argv[1]
|
||||
else:
|
||||
print("Syntax: %s directory" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
# get files in specified directory and prepend the full path
|
||||
entries = [os.path.join(directory, file) for file in os.listdir(directory)]
|
||||
|
||||
# filter out non-files
|
||||
files = [f for f in entries if os.path.isfile(f)]
|
||||
|
||||
# transform list of filenames into list of (filename,unixtimestamp) tuples
|
||||
files = [[f, os.stat(f)[-2]] for f in files]
|
||||
|
||||
# sort files by timestamp
|
||||
sorted_files = sorted(files, key=lambda e: e[1])
|
||||
|
||||
# convert from Unix timestamp to python datetime object
|
||||
filetime = datetime.fromtimestamp(sorted_files[0][1])
|
||||
|
||||
# print as human-readable date (which it defaults to)
|
||||
print(filetime, sorted_files[0][0])
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
|
||||
path = os.getenv('PATH')
|
||||
paths = path.split(os.pathsep)
|
||||
|
||||
for path_dir in paths:
|
||||
if os.path.exists(path_dir):
|
||||
all_files = os.listdir(path_dir)
|
||||
print("{}: {}".format(path_dir, len(all_files)))
|
||||
else:
|
||||
print("WARNING: {} is in PATH, but does not exist".format(path_dir))
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 23:34:17 2013
|
||||
|
||||
"""
|
||||
import csv
|
||||
import pickle
|
||||
|
||||
presidents = {}
|
||||
|
||||
with open('../DATA/presidents.csv') as president_in:
|
||||
rdr = csv.reader(president_in)
|
||||
for row in rdr:
|
||||
term_num = int(row[0])
|
||||
presidents[term_num] = {
|
||||
"firstname": row[1],
|
||||
"lastname": row[2],
|
||||
"birthplace": row[3],
|
||||
"birthstate": row[4],
|
||||
"party": row[5],
|
||||
}
|
||||
|
||||
with open('presidents.pic','wb') as president_out:
|
||||
pickle.dump(presidents, president_out)
|
||||
|
||||
# note: prior to Python 3.6, presidents will come out in arbitrary order. Use
|
||||
# collections.ordereddict to get this behavior in earlier versions:
|
||||
#
|
||||
# from collections import ordereddict
|
||||
# presidents = ordereddict()
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from datetime import date
|
||||
|
||||
def mkdate(raw_date):
|
||||
if raw_date != "NONE":
|
||||
raw_year, raw_month, raw_day = raw_date.split('-')
|
||||
d = date(int(raw_year), int(raw_month), int(raw_day))
|
||||
else:
|
||||
d = None
|
||||
|
||||
return d
|
||||
|
||||
def get_info(index):
|
||||
pres_data = {}
|
||||
with open("../DATA/presidents.txt") as pres_in:
|
||||
for line in pres_in:
|
||||
flds = line[:-1].split(":")
|
||||
if int(flds[0]) == index:
|
||||
pres_data["lastname"] = flds[1]
|
||||
pres_data["firstname"] = flds[2]
|
||||
|
||||
pres_data["birthdate"] = mkdate(flds[3])
|
||||
pres_data["deathdate"] = mkdate(flds[4])
|
||||
|
||||
pres_data["birthplace"] = flds[5]
|
||||
pres_data["birthstate"] = flds[6]
|
||||
|
||||
pres_data["termstart"] = mkdate(flds[7])
|
||||
pres_data["termend"] = mkdate(flds[8])
|
||||
|
||||
pres_data["party"] = flds[9]
|
||||
|
||||
break
|
||||
|
||||
return pres_data
|
||||
|
||||
def get_all_data():
|
||||
all_data = []
|
||||
for i in range(1, 44):
|
||||
all_data.append(get_info(i))
|
||||
return all_data
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from datetime import date
|
||||
|
||||
NUM_TERMS = 45
|
||||
|
||||
def mkdate(raw_date):
|
||||
if raw_date == "NONE":
|
||||
d = None
|
||||
else:
|
||||
raw_year, raw_month, raw_day = raw_date.split('-')
|
||||
d = date(int(raw_year), int(raw_month), int(raw_day))
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def get_info(index):
|
||||
pres_data = {}
|
||||
with open("../DATA/presidents.txt") as pres_in:
|
||||
for line in pres_in:
|
||||
flds = line[:-1].split(":")
|
||||
if int(flds[0]) == index:
|
||||
pres_data["lastname"] = flds[1]
|
||||
pres_data["firstname"] = flds[2]
|
||||
|
||||
pres_data["birthdate"] = mkdate(flds[3])
|
||||
pres_data["deathdate"] = mkdate(flds[4])
|
||||
|
||||
pres_data["birthplace"] = flds[5]
|
||||
pres_data["birthstate"] = flds[6]
|
||||
|
||||
pres_data["termstart"] = mkdate(flds[7])
|
||||
pres_data["termend"] = mkdate(flds[8])
|
||||
|
||||
pres_data["party"] = flds[9]
|
||||
|
||||
break
|
||||
|
||||
return pres_data
|
||||
|
||||
|
||||
def get_all_data():
|
||||
all_data = []
|
||||
for i in range(1, NUM_TERMS):
|
||||
all_data.append(get_info(i))
|
||||
return all_data
|
||||
|
||||
|
||||
def get_age_at_term_end(pinfo):
|
||||
birthdate = pinfo["birthdate"]
|
||||
termend = pinfo["termend"]
|
||||
if termend is None:
|
||||
termend = date.today()
|
||||
age_at_end = termend - birthdate
|
||||
return age_at_end.days / 365.25
|
||||
|
||||
|
||||
def get_age_extreme(*, get_youngest=True):
|
||||
all_raw = get_all_data()
|
||||
all_cooked = sorted(all_raw, key=get_age_at_term_end)
|
||||
return all_cooked[0] if get_youngest else all_cooked[-1]
|
||||
|
||||
|
||||
def get_oldest():
|
||||
return get_age_extreme(get_youngest=False)
|
||||
|
||||
|
||||
def get_youngest():
|
||||
return get_age_extreme()
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
from potus_amb import get_info, get_oldest, get_youngest, NUM_TERMS
|
||||
|
||||
print('PRESIDENT 1:')
|
||||
for k, v in get_info(1).items():
|
||||
print(k, v)
|
||||
print()
|
||||
|
||||
print('PRESIDENT {}:'.format(NUM_TERMS))
|
||||
for k, v in get_info(NUM_TERMS).items():
|
||||
print(k, v)
|
||||
print()
|
||||
|
||||
oldster = get_oldest()
|
||||
print("Oldest is", oldster["firstname"], oldster["lastname"])
|
||||
|
||||
youngster = get_youngest()
|
||||
print("Youngest is", youngster["firstname"], youngster["lastname"])
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
from potus import get_info
|
||||
|
||||
for i in range(1, 46):
|
||||
print('PRESIDENT {}:'.format(i))
|
||||
for field, value in get_info(i).items():
|
||||
print(field, value)
|
||||
print()
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from president import President
|
||||
|
||||
for pres_term in 1, 26, 37:
|
||||
p = President(pres_term)
|
||||
|
||||
lastname = getattr(p, 'last_name')
|
||||
firstname = getattr(p, 'first_name')
|
||||
party = getattr(p, 'party')
|
||||
print (firstname, lastname, 'was a', party)
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/python
|
||||
import datetime
|
||||
|
||||
FILE = '../DATA/presidents.txt'
|
||||
|
||||
def main():
|
||||
info = []
|
||||
with open(FILE) as presidents_in:
|
||||
for line in presidents_in:
|
||||
(
|
||||
term, lname, fname, bdate, ddate, bplace, bstate, tsdate, tedate,
|
||||
party
|
||||
) = line[:-1].split(':')
|
||||
|
||||
name = '{} {}'.format(fname, lname)
|
||||
|
||||
birth_date = make_date(bdate)
|
||||
|
||||
info.append((name, birth_date, party))
|
||||
|
||||
for name, date, party in sorted(info, key=lambda e: e[1]):
|
||||
print("{:35s} {} {}".format(name, date, party))
|
||||
|
||||
def make_date(date_str):
|
||||
year, month, day = date_str.split('-')
|
||||
date = datetime.date(int(year), int(month), int(day))
|
||||
return date
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
with open("../DATA/presidents.txt") as pres_in:
|
||||
count_of = {}
|
||||
|
||||
for rec in pres_in:
|
||||
flds = rec.split(":")
|
||||
state = flds[6]
|
||||
if state in count_of:
|
||||
count_of[state] += 1
|
||||
else:
|
||||
count_of[state] = 1
|
||||
|
||||
for state, count in sorted(count_of.items()):
|
||||
print("%-16s %2d" % (state, count))
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
with open("../DATA/presidents.txt") as pres_in:
|
||||
count_of = {}
|
||||
|
||||
for rec in pres_in:
|
||||
flds = rec.split(":")
|
||||
state = flds[6]
|
||||
if state in count_of:
|
||||
count_of[state] += 1
|
||||
else:
|
||||
count_of[state] = 1
|
||||
|
||||
for state, count in sorted(count_of.items(), key=lambda e: (-e[1], e[0])):
|
||||
print(("%-16s %2d" % (state, count)))
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
pres_lname = input("Enter president's last name: ")
|
||||
|
||||
with open("../DATA/presidents.txt") as PRES:
|
||||
for rec in PRES:
|
||||
flds = rec.split(":")
|
||||
if flds[1] == pres_lname:
|
||||
if flds[4] == "NONE":
|
||||
alive = True
|
||||
else:
|
||||
alive = False
|
||||
|
||||
print("NAME: {} {}".format(flds[2], flds[1]))
|
||||
print("BIRTH: ", flds[3])
|
||||
print("DEATH: ", end='')
|
||||
if alive:
|
||||
print('* * *')
|
||||
else:
|
||||
print(flds[4])
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
pres_lname = input("Enter president's last name: ")
|
||||
|
||||
with open("../DATA/presidents.txt") as PRES:
|
||||
for rec in PRES:
|
||||
flds = rec.split(":")
|
||||
if flds[1].lower().startswith(pres_lname.lower()):
|
||||
if flds[4] == 'NONE':
|
||||
alive = True
|
||||
else:
|
||||
alive = False
|
||||
|
||||
print("NAME: {} {}".format(flds[2], flds[1]))
|
||||
print("BIRTH: ", flds[3])
|
||||
print("DEATH: ", end='')
|
||||
if alive:
|
||||
print('* * *')
|
||||
else:
|
||||
print(flds[4])
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
def pres_upper():
|
||||
with open('../DATA/presidents.txt') as pres_in:
|
||||
for line in pres_in:
|
||||
_, lname, fname, *_ = line.rstrip().split(':')
|
||||
|
||||
yield '{} {}'.format(fname, lname).upper()
|
||||
|
||||
for p in pres_upper():
|
||||
print(p)
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from president import President
|
||||
|
||||
|
||||
def fn(self):
|
||||
return '%s %s' % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
setattr(President, 'get_full_name', fn)
|
||||
# or just
|
||||
# President.getFullName = fn
|
||||
|
||||
abe = President(16)
|
||||
print(abe.get_full_name())
|
||||
|
||||
millard = President(13)
|
||||
print(millard.get_full_name())
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from president import President
|
||||
|
||||
|
||||
@property
|
||||
def fn(self):
|
||||
return '%s %s' % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
setattr(President, 'full_name', fn)
|
||||
# or just
|
||||
# President.getFullName = fn
|
||||
|
||||
abe = President(16)
|
||||
print(abe.full_name)
|
||||
|
||||
millard = President(13)
|
||||
print(millard.full_name)
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
from multiprocessing.dummy import Pool
|
||||
from datetime import date
|
||||
import time
|
||||
|
||||
start = time.time()
|
||||
|
||||
with open('../DATA/presidents.txt') as pres_in:
|
||||
presidents = [tuple(line.rstrip().split(':')) for line in pres_in]
|
||||
|
||||
def age_at_inauguration(president):
|
||||
birth_date = date(*(int(i) for i in president[3].split('-')))
|
||||
inauguration_date = date(*(int(i) for i in president[7].split('-')))
|
||||
age = (inauguration_date - birth_date).days / 365.25
|
||||
return round(age, 2)
|
||||
|
||||
|
||||
p = Pool(8)
|
||||
|
||||
results = p.map(age_at_inauguration, presidents)
|
||||
|
||||
print(results, "\n")
|
||||
|
||||
print(sorted(results))
|
||||
print()
|
||||
|
||||
average_ages = sum(results)/len(results)
|
||||
print("average age at inauguration: {:.2f}".format(average_ages))
|
||||
|
||||
print
|
||||
|
||||
end = time.time()
|
||||
print("elapsed: {:.5f} seconds".format(end - start))
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
last_names = []
|
||||
with open('../DATA/presidents.txt') as pres_in:
|
||||
for line in pres_in:
|
||||
last_name = line.split(':')[1]
|
||||
last_names.append(last_name)
|
||||
|
||||
print(last_names)
|
||||
|
||||
last_names_upper = [ln.upper() for ln in last_names]
|
||||
|
||||
for last_name in last_names_upper:
|
||||
print(last_name)
|
||||
@@ -0,0 +1,76 @@
|
||||
from datetime import date
|
||||
|
||||
|
||||
class President():
|
||||
def __init__(self, index):
|
||||
self._get_data(index)
|
||||
|
||||
@staticmethod
|
||||
def _mkdate(raw_date):
|
||||
if raw_date != "NONE":
|
||||
raw_year, raw_month, raw_day = raw_date.split('-')
|
||||
d = date(int(raw_year), int(raw_month), int(raw_day))
|
||||
else:
|
||||
d = None
|
||||
|
||||
return d
|
||||
|
||||
def _get_data(self, index):
|
||||
with open("../DATA/presidents.txt") as pfile:
|
||||
for line in pfile:
|
||||
flds = line.rstrip().split(":")
|
||||
if int(flds[0]) == int(index):
|
||||
self._lname = flds[1]
|
||||
|
||||
self._fname = flds[2]
|
||||
|
||||
self._bdate = self._mkdate(flds[3])
|
||||
self._ddate = self._mkdate(flds[4])
|
||||
|
||||
self._bplace = flds[5]
|
||||
self._bstate = flds[6]
|
||||
|
||||
self._ts_date = self._mkdate(flds[7])
|
||||
self._te_date = self._mkdate(flds[8])
|
||||
|
||||
self._party = flds[9]
|
||||
|
||||
break
|
||||
else:
|
||||
raise ValueError("Invalid term number")
|
||||
|
||||
@property
|
||||
def last_name(self):
|
||||
return self._lname
|
||||
|
||||
@property
|
||||
def first_name(self):
|
||||
return self._fname
|
||||
|
||||
@property
|
||||
def birth_date(self):
|
||||
return self._bdate
|
||||
|
||||
@property
|
||||
def death_date(self):
|
||||
return self._ddate
|
||||
|
||||
@property
|
||||
def birth_place(self):
|
||||
return self._bplace
|
||||
|
||||
@property
|
||||
def birth_state(self):
|
||||
return self._bstate
|
||||
|
||||
@property
|
||||
def term_start_date(self):
|
||||
return self._ts_date
|
||||
|
||||
@property
|
||||
def term_end_date(self):
|
||||
return self._te_date
|
||||
|
||||
@property
|
||||
def party(self):
|
||||
return self._party
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
from president import President
|
||||
|
||||
for term in 1, 26, 39, 45:
|
||||
p = President(term) # George Washington
|
||||
|
||||
print("{} {} was born at {}, {} on {}".format(
|
||||
p.first_name, p.last_name, p.birth_place, p.birth_state, p.birth_date
|
||||
))
|
||||
print()
|
||||
@@ -0,0 +1,79 @@
|
||||
import pymysql
|
||||
|
||||
|
||||
class President(object):
|
||||
PRES_QUERY = '''
|
||||
select num, lname, fname, dstart, dend, birthplace, birthstate,
|
||||
dbirth, ddeath, party
|
||||
from presidents
|
||||
where num = %s
|
||||
'''
|
||||
|
||||
def __init__(self, index):
|
||||
self._get_data(index)
|
||||
|
||||
def _get_data(self, index):
|
||||
conn = pymysql.connect(
|
||||
host="localhost",
|
||||
db="python2",
|
||||
user="scripts",
|
||||
passwd="scripts"
|
||||
)
|
||||
cur = conn.cursor()
|
||||
row_count = cur.execute(President.PRES_QUERY, (index,))
|
||||
if row_count == 1:
|
||||
row = cur.fetchone()
|
||||
self._termnum = row[0]
|
||||
self._lname = row[1]
|
||||
self._fname = row[2]
|
||||
self._ts_date = row[3]
|
||||
self._te_date = row[4]
|
||||
self._bplace = row[5]
|
||||
self._bstate = row[6]
|
||||
self._bdate = row[7]
|
||||
self._ddate = row[8]
|
||||
self._party = row[9]
|
||||
else:
|
||||
print("Term {} not found".format(index))
|
||||
|
||||
@property
|
||||
def last_name(self):
|
||||
return self._lname
|
||||
|
||||
@property
|
||||
def first_name(self):
|
||||
return self._fname
|
||||
|
||||
@property
|
||||
def birth_date(self):
|
||||
return self._bdate
|
||||
|
||||
@property
|
||||
def death_date(self):
|
||||
return self._ddate
|
||||
|
||||
@property
|
||||
def birth_place(self):
|
||||
return self._bplace
|
||||
|
||||
@property
|
||||
def birth_state(self):
|
||||
return self._bstate
|
||||
|
||||
@property
|
||||
def term_start(self):
|
||||
return self._ts_date
|
||||
|
||||
@property
|
||||
def term_end(self):
|
||||
return self._te_date
|
||||
|
||||
@property
|
||||
def party(self):
|
||||
return self._party
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for term in 1, 16, 26, 44, 45:
|
||||
p = President(term)
|
||||
print(p.first_name, p.last_name, p.party)
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from datetime import date
|
||||
import sqlite3
|
||||
|
||||
|
||||
class President(object):
|
||||
PRES_QUERY = '''
|
||||
select termnum, lastname, firstname, termstart, termend, birthplace, birthstate,
|
||||
birthdate, deathdate, party
|
||||
from presidents
|
||||
where termnum = ?
|
||||
'''
|
||||
|
||||
def __init__(self, index):
|
||||
self._get_data(index)
|
||||
|
||||
def _get_data(self, index):
|
||||
conn = sqlite3.connect("../DATA/presidents.db")
|
||||
|
||||
cur = conn.cursor()
|
||||
cur.execute(President.PRES_QUERY, (index,))
|
||||
row = cur.fetchone()
|
||||
if row:
|
||||
self._termnum = row[0]
|
||||
self._lname = row[1]
|
||||
self._fname = row[2]
|
||||
self._ts_date = row[3]
|
||||
self._te_date = row[4] if row[4] else date.today()
|
||||
self._bplace = row[5]
|
||||
self._bstate = row[6]
|
||||
self._bdate = row[7]
|
||||
self._ddate = row[8] if row[8] else "(still living)"
|
||||
self._party = row[9]
|
||||
else:
|
||||
print("Term {} not found".format(index))
|
||||
|
||||
@property
|
||||
def last_name(self):
|
||||
return self._lname
|
||||
|
||||
@property
|
||||
def first_name(self):
|
||||
return self._fname
|
||||
|
||||
@property
|
||||
def birth_date(self):
|
||||
return self._bdate
|
||||
|
||||
@property
|
||||
def death_date(self):
|
||||
return self._ddate
|
||||
|
||||
@property
|
||||
def birth_place(self):
|
||||
return self._bplace
|
||||
|
||||
@property
|
||||
def birth_state(self):
|
||||
return self._bstate
|
||||
|
||||
@property
|
||||
def term_start(self):
|
||||
return self._ts_date
|
||||
|
||||
@property
|
||||
def term_end(self):
|
||||
return self._te_date
|
||||
|
||||
@property
|
||||
def party(self):
|
||||
return self._party
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for term in 1, 16, 26, 44:
|
||||
p = President(term)
|
||||
print(p.first_name, p.last_name, p.party)
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
# (c) 2018 CJ Associates
|
||||
#
|
||||
from struct import Struct
|
||||
|
||||
puzzle_layout = 'fififhHfIdfdIiIh'
|
||||
layout = Struct(puzzle_layout)
|
||||
|
||||
with open('../DATA/puzzle.data', 'rb') as puzzle_in:
|
||||
puzzle_data = puzzle_in.read()
|
||||
|
||||
values = layout.unpack(puzzle_data)
|
||||
|
||||
bytes = [int(v) for v in values]
|
||||
|
||||
name_letters = [chr(b) for b in bytes]
|
||||
|
||||
print(''.join(name_letters))
|
||||
|
||||
|
||||
# one-liner version -- just don't do this in production!!
|
||||
print(''.join([chr(int(v)) for v in layout.unpack(open('../DATA/puzzle.data', 'rb').read())]))
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 23:52:46 2013
|
||||
|
||||
"""
|
||||
import pickle
|
||||
from collections import namedtuple
|
||||
|
||||
fields = 'term firstname lastname birthstate party'
|
||||
President = namedtuple('President', fields)
|
||||
|
||||
# note: In Real Life, definition of President would be
|
||||
# in module shared between read_potus_info.py
|
||||
# and save_potus_info.py
|
||||
|
||||
with open('potus.pic','rb') as POTUS:
|
||||
presidents = pickle.load(POTUS)
|
||||
|
||||
for p in presidents:
|
||||
print("{} {}".format(p.firstname, p.lastname))
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 23:34:17 2013
|
||||
|
||||
"""
|
||||
import csv
|
||||
import pickle
|
||||
from collections import namedtuple
|
||||
|
||||
fields = 'term firstname lastname birthplace birthstate party'
|
||||
President = namedtuple('President', fields)
|
||||
|
||||
presidents = []
|
||||
with open('../DATA/presidents.csv') as presidents_in:
|
||||
rdr = csv.reader(presidents_in)
|
||||
for row in rdr:
|
||||
president = President(*row)
|
||||
presidents.append(president)
|
||||
|
||||
p = presidents[15]
|
||||
print(p.firstname, p.lastname, p.party)
|
||||
|
||||
with open('potus.pic','wb') as POTUS:
|
||||
pickle.dump(presidents,POTUS)
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.image import MIMEImage
|
||||
|
||||
SMTP_SERVER = "smtpcorp.com"
|
||||
SMTP_PORT = 2525
|
||||
SMTP_USER = 'jstrickpython'
|
||||
SMTP_PWD = 'python(monty)'
|
||||
|
||||
SENDER = 'jstrick@mindspring.com'
|
||||
RECIPIENTS = ['jstrickler@gmail.com']
|
||||
|
||||
msg = MIMEMultipart("Please enjoy this picture of a chimp")
|
||||
msg['Subject'] = "A chimp for you"
|
||||
|
||||
file_name = '../DATA/chimp.bmp'
|
||||
with open(file_name, 'rb') as file_in:
|
||||
attachment_data = file_in.read()
|
||||
|
||||
short_name = os.path.basename(file_name)
|
||||
attachment = MIMEImage(attachment_data)
|
||||
attachment.add_header(
|
||||
'Content-Disposition', 'attachment', filename=short_name
|
||||
)
|
||||
|
||||
msg.attach(attachment)
|
||||
|
||||
smtp = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
|
||||
smtp.login(SMTP_USER, SMTP_PWD)
|
||||
|
||||
smtp.sendmail(
|
||||
SENDER,
|
||||
RECIPIENTS,
|
||||
msg.as_string()
|
||||
)
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
def main():
|
||||
ss1 = SillyString('this is a test')
|
||||
|
||||
print(ss1.every_other())
|
||||
print()
|
||||
|
||||
ss2 = SillyString('Dximd8 *i@tz !w7ogrvkb?#')
|
||||
|
||||
print(ss2.every_other())
|
||||
|
||||
|
||||
def _every_other(self):
|
||||
return self._string[::2]
|
||||
|
||||
|
||||
def _init(self, string):
|
||||
self._string = string
|
||||
|
||||
|
||||
SillyString = type(
|
||||
'SillyString', # internal class name
|
||||
(), # empty list of base classes
|
||||
{'__init__': _init, 'every_other': _every_other} # class dict
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/python
|
||||
import pytest
|
||||
from president import President
|
||||
from datetime import date
|
||||
|
||||
|
||||
def test_president_one_last_name_is_george():
|
||||
p = President(1)
|
||||
assert p.first_name == "George"
|
||||
|
||||
|
||||
@pytest.mark.parametrize('term_number', range(1, 46))
|
||||
def test_date_fields_return_dates_or_none(term_number):
|
||||
p = President(term_number)
|
||||
assert isinstance(p.birth_date, date) or p.birth_date is None
|
||||
assert isinstance(p.death_date, date) or p.death_date is None
|
||||
assert isinstance(p.term_start_date, date) or p.term_start_date is None
|
||||
assert isinstance(p.term_end_date, date) or p.term_end_date is None
|
||||
|
||||
@pytest.mark.parametrize('invalid_term', [-1, 0, 46, 1000])
|
||||
def test_invalid_term_raises_error(invalid_term):
|
||||
with pytest.raises(ValueError):
|
||||
p = President(invalid_term)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pytest.main([__file__, '-v'])
|
||||
@@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'gpresinfo.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.6
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_PresInfo(object):
|
||||
def setupUi(self, PresInfo):
|
||||
PresInfo.setObjectName("PresInfo")
|
||||
PresInfo.resize(377, 309)
|
||||
self.centralwidget = QtWidgets.QWidget(PresInfo)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 381, 261))
|
||||
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.labTermNum = QtWidgets.QLabel(self.verticalLayoutWidget)
|
||||
self.labTermNum.setObjectName("labTermNum")
|
||||
self.horizontalLayout_2.addWidget(self.labTermNum)
|
||||
self.leTermNum = QtWidgets.QLineEdit(self.verticalLayoutWidget)
|
||||
self.leTermNum.setObjectName("leTermNum")
|
||||
self.horizontalLayout_2.addWidget(self.leTermNum)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
|
||||
self.btGetInfo = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btGetInfo.setObjectName("btGetInfo")
|
||||
self.verticalLayout_2.addWidget(self.btGetInfo)
|
||||
self.pteInfo = QtWidgets.QPlainTextEdit(self.verticalLayoutWidget)
|
||||
self.pteInfo.setObjectName("pteInfo")
|
||||
self.verticalLayout_2.addWidget(self.pteInfo)
|
||||
PresInfo.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(PresInfo)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 377, 25))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menuFIle = QtWidgets.QMenu(self.menubar)
|
||||
self.menuFIle.setObjectName("menuFIle")
|
||||
PresInfo.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(PresInfo)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
PresInfo.setStatusBar(self.statusbar)
|
||||
self.actionQuit = QtWidgets.QAction(PresInfo)
|
||||
self.actionQuit.setObjectName("actionQuit")
|
||||
self.menuFIle.addAction(self.actionQuit)
|
||||
self.menubar.addAction(self.menuFIle.menuAction())
|
||||
|
||||
self.retranslateUi(PresInfo)
|
||||
QtCore.QMetaObject.connectSlotsByName(PresInfo)
|
||||
|
||||
def retranslateUi(self, PresInfo):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
PresInfo.setWindowTitle(_translate("PresInfo", "President Info"))
|
||||
self.labTermNum.setText(_translate("PresInfo", "Enter Term Number:"))
|
||||
self.btGetInfo.setText(_translate("PresInfo", "Get Information"))
|
||||
self.menuFIle.setTitle(_translate("PresInfo", "FIle"))
|
||||
self.actionQuit.setText(_translate("PresInfo", "Quit"))
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 23:52:46 2013
|
||||
|
||||
"""
|
||||
import pickle
|
||||
|
||||
with open('presidents.pic','rb') as presidents_in:
|
||||
presidents = pickle.load(presidents_in)
|
||||
|
||||
for term_number, president_info in presidents.items():
|
||||
print("{:20.20s} {:20.20s} {}".format(
|
||||
president_info['firstname'],
|
||||
president_info['lastname'],
|
||||
president_info['party'],
|
||||
))
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
# (c) 2018 CJ Associates
|
||||
#
|
||||
import requests
|
||||
|
||||
URL = "https://www.wikipedia.org/"
|
||||
|
||||
response = requests.get(URL)
|
||||
|
||||
|
||||
if response.status_code == requests.codes.OK:
|
||||
link_count = 0
|
||||
page_content = response.content.decode() # convert from bytes to string
|
||||
|
||||
start = 0
|
||||
while True:
|
||||
pos = page_content.find('href', start)
|
||||
if pos == -1: # no more strings
|
||||
break
|
||||
start = pos + 1
|
||||
link_count += 1
|
||||
|
||||
print("There are {} links on the Wikipedia main page".format(link_count))
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
# (c) 2018 CJ Associates
|
||||
#
|
||||
from urllib.request import urlopen
|
||||
|
||||
URL = "https://www.wikipedia.org/"
|
||||
|
||||
link_count = 0
|
||||
|
||||
with urlopen(URL) as url_in:
|
||||
page_content = url_in.read().decode() # convert from bytes to string
|
||||
|
||||
start = 0
|
||||
while True:
|
||||
pos = page_content.find('href', start)
|
||||
if pos == -1: # no more strings
|
||||
break
|
||||
start = pos + 1
|
||||
link_count += 1
|
||||
|
||||
print("There are {} links on the Wikipedia main page".format(link_count))
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
from collections import defaultdict
|
||||
|
||||
class WordSelect():
|
||||
function_registry = defaultdict(list) # dict of (min_len, max_len):[func_list] pairs
|
||||
|
||||
def __call__(self, min_len, max_len):
|
||||
"""
|
||||
Decorator for word-processing functions. Apply to functions to select words of specified lengths.
|
||||
|
||||
:param min_len: Minimum word length for the decorated function
|
||||
:param max_len: Maximum word length for the decorated function
|
||||
:return: wrapper ("real" decorator)
|
||||
"""
|
||||
|
||||
def wrapper(old_function):
|
||||
"""
|
||||
Register function with corresponding max/min values
|
||||
|
||||
:param old_function: function to be registered
|
||||
:return: replacement function (actually original function)
|
||||
"""
|
||||
# add function to registry indexed by min_len, max_len
|
||||
self.function_registry[(min_len, max_len)].append(old_function)
|
||||
|
||||
return old_function # no changes needed
|
||||
|
||||
return wrapper
|
||||
|
||||
def process_words(self):
|
||||
"""
|
||||
Process the list of words from the words.txt file.
|
||||
|
||||
For each word, check to see if the length is within the range for each
|
||||
list of functions. If so, call all the functions for the word and print the result.
|
||||
|
||||
:return: None. Note: could return list of words, rather than printing them
|
||||
"""
|
||||
with open('../DATA/words.txt') as words_in:
|
||||
for raw_word in words_in:
|
||||
word = raw_word.rstrip()
|
||||
word_len = len(word)
|
||||
for (min_len, max_len), word_functions in self.function_registry.items():
|
||||
if (word_len >= min_len) and (word_len <= max_len):
|
||||
for word_function in word_functions:
|
||||
result = word_function(word)
|
||||
print(result)
|
||||
|
||||
word_select = WordSelect() # create (callable) instance of class
|
||||
|
||||
@word_select(16, 18)
|
||||
def make_upper(s):
|
||||
return s.upper()
|
||||
|
||||
@word_select(18, 20)
|
||||
def reverse_word(s):
|
||||
return s[::-1]
|
||||
|
||||
@word_select(22, 22)
|
||||
def add_stars(s):
|
||||
return '*** ' + s
|
||||
|
||||
@word_select(1, 2)
|
||||
def times_10(s):
|
||||
return "-".join([s] * 10)
|
||||
|
||||
word_select.process_words()
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
|
||||
@author: jstrick
|
||||
Created on Wed Mar 20 21:24:35 2013
|
||||
|
||||
"""
|
||||
from datetime import date as Date
|
||||
|
||||
ww2_start = Date(1941, 12, 7)
|
||||
ww2_end = Date(1945, 8, 15)
|
||||
|
||||
elapsed_time = ww2_end - ww2_start
|
||||
|
||||
print("World War II lasted {} days".format(elapsed_time.days))
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
presroot = ET.parse('../DATA/presidents.xml')
|
||||
|
||||
for pres in presroot.findall("president"):
|
||||
name = pres.findtext('name/last') + ', ' + pres.findtext('name/first')
|
||||
state = pres.findtext('birthstate')
|
||||
print('{0:40s} {1:30s}'.format(name, state))
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
words = open('../DATA/words.txt')
|
||||
xwords = [word.rstrip() for word in words if word.startswith('x')]
|
||||
words.close()
|
||||
|
||||
root = ET.Element('words')
|
||||
|
||||
for word in xwords:
|
||||
ET.SubElement(root, 'word').text = word
|
||||
|
||||
tree = ET.ElementTree(root)
|
||||
tree.write('xwords.xml')
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
def make_date(date_string):
|
||||
raw_year, raw_month, raw_day = date_string.split('-')
|
||||
year = int(raw_year)
|
||||
month = int(raw_month)
|
||||
day = int(raw_day)
|
||||
|
||||
return datetime.date(year, month, day)
|
||||
|
||||
|
||||
all_presidents = []
|
||||
|
||||
with open("../DATA/presidents.txt") as PRES:
|
||||
for rec in PRES:
|
||||
_, last_name, first_name, birthday, _, _, _, inauguration_day, *_ = rec.split(":")
|
||||
|
||||
birth_date = make_date(birthday)
|
||||
took_office_date = make_date(inauguration_day)
|
||||
|
||||
raw_age_at_inauguration = took_office_date - birth_date
|
||||
age_at_inauguration = round(raw_age_at_inauguration.days / 365.25, 1)
|
||||
|
||||
full_name = '{} {}'.format(first_name, last_name)
|
||||
|
||||
all_presidents.append((age_at_inauguration, full_name))
|
||||
|
||||
for age, name in sorted(all_presidents):
|
||||
print(name, age)
|
||||
@@ -0,0 +1,5 @@
|
||||
Arthur:King:blue:The Grail:King of the Britons
|
||||
Lancelot:Sir:red:The Grail:'I could handle some more peril'
|
||||
Robin:Sir:yellow:Not Sure:He boldly ran away
|
||||
Bedevere:Sir:red, no blue!:The Grail:AARRRRRRRGGGGHH
|
||||
Gawain:Sir:blue:The Grail:none
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 214 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,42 @@
|
||||
|
||||
---
|
||||
- name: Beatles
|
||||
genre: rock
|
||||
members:
|
||||
- John Lennon
|
||||
- Paul McCartney
|
||||
- Ringo Starr
|
||||
- George Harrison
|
||||
|
||||
- name: Rolling Stones
|
||||
genre: rock
|
||||
members:
|
||||
- Mick Jagger
|
||||
- Keith Emerson
|
||||
- Ronnie Wood
|
||||
- Charlie Watts
|
||||
|
||||
- name: Flecktones
|
||||
genre: jazz
|
||||
members:
|
||||
- Bela Fleck
|
||||
- Victor Wooten
|
||||
- Jeff Coffin
|
||||
- Futureman
|
||||
- Howard Levy
|
||||
|
||||
- name: King Crimson
|
||||
genre: progressive rock
|
||||
members:
|
||||
- Robert Fripp
|
||||
- Adrian Belew
|
||||
- Mel Collins
|
||||
- Tony Levin
|
||||
- Pat Mastelotto
|
||||
- Gavin Harrison
|
||||
- Jakko Jakszyk
|
||||
- Jeremy Stacey
|
||||
- Chris Gibson
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
spam
|
||||
spam
|
||||
spam
|
||||
spam
|
||||
eggs
|
||||
spam
|
||||
spam
|
||||
eggs
|
||||
spam
|
||||
spam
|
||||
spam
|
||||
crumpets
|
||||
spam
|
||||
eggs
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,10 @@
|
||||
Melinda;Gates;Gates Foundation;1964-08-15
|
||||
Steve;Jobs;Apple;1955-02-24
|
||||
Larry;Wall;Perl;1954-09-27
|
||||
Paul;Allen;Microsoft;1953-01-21
|
||||
Larry;Ellison;Oracle;1944-08-17
|
||||
Bill;Gates;Microsoft;1955-10-28
|
||||
Mark;Zuckerberg;Facebook;1984-05-14
|
||||
Sergey;Brin;Google;1973-08-21
|
||||
Larry;Page;Google;1973-03-26
|
||||
Linus;Torvalds;Linux;1969-12-28
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 517 KiB |
@@ -0,0 +1,28 @@
|
||||
invoice: 34843
|
||||
date : 2001-01-23
|
||||
bill-to: &id001
|
||||
given : Chris
|
||||
family : Dumars
|
||||
address:
|
||||
lines: |
|
||||
458 Walkman Dr.
|
||||
Suite #292
|
||||
city : Royal Oak
|
||||
state : MI
|
||||
postal : 48046
|
||||
ship-to: *id001
|
||||
product:
|
||||
- sku : BL394D
|
||||
quantity : 4
|
||||
description : Basketball
|
||||
price : 450.00
|
||||
- sku : BL4438H
|
||||
quantity : 1
|
||||
description : Super Hoop
|
||||
price : 2392.00
|
||||
tax : 251.42
|
||||
total: 4443.42
|
||||
comments: >
|
||||
Late afternoon is best.
|
||||
Backup contact is Nancy
|
||||
Billsmer @ 338-4338.
|
||||
@@ -0,0 +1,5 @@
|
||||
Arthur,King,blue,The Grail,King of the Britons,5,"Guinevere"
|
||||
Lancelot,Sir,red,The Grail,'I could handle some more peril',8,"Winston,Piglet,Guinevere"
|
||||
Robin,Sir,yellow,"Not Sure","He boldly ran away",9,"Wanda,Bridgette,Latoya"
|
||||
Bedevere,Sir,"red, no blue!","The Grail",AARRRRRRRGGGGHH,7,"Galadriel"
|
||||
Gawain,Sir,blue,"The Grail",none,1,"Mab, Freida"
|
||||
|
@@ -0,0 +1,6 @@
|
||||
Arthur:King:blue:The Grail:King of the Britons
|
||||
Galahad:Sir:red:The Grail:'I could handle some more peril'
|
||||
Lancelot:Sir:blue:The Grail:"It's too perilous!"
|
||||
Robin:Sir:yellow:Not Sure:He boldly ran away
|
||||
Bedevere:Sir:red, no blue!:The Grail:AARRRRRRRGGGGHH
|
||||
Gawain:Sir:blue:The Grail:none
|
||||
@@ -0,0 +1,4 @@
|
||||
Mary had a little lamb,
|
||||
Its fleece was white as snow,
|
||||
And everywhere that Mary went
|
||||
The lamb was sure to go
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
So there's this fella with a parrot. And this parrot swears
|
||||
like a sailor, I mean he's a pistol. He can swear for five minutes
|
||||
straight without repeating himself. Trouble is, the guy who owns
|
||||
him is a quiet, conservative type, and this bird's foul mouth is
|
||||
driving him crazy.
|
||||
|
||||
One day, it gets to be too much, so the guy grabs the bird by the
|
||||
throat, shakes him really hard, and yells, "QUIT IT!" But this just
|
||||
makes the bird mad and he swears more than ever.
|
||||
|
||||
Then the guy gets mad and says, "OK, fork you." and locks the bird
|
||||
in a kitchen cabinet.
|
||||
|
||||
This really aggravates the bird and he claws and scratches,
|
||||
and when the guy finally lets him out, the bird cuts loose with a
|
||||
stream of invective that would make a veteran sailor blush.
|
||||
|
||||
At that point, the guy is so mad that he throws the bird into the
|
||||
freezer.
|
||||
|
||||
For the first few seconds there is a terrible din. The bird kicks
|
||||
and claws and thrashes. Then it suddenly gets _very_ quiet.
|
||||
|
||||
At first the guy just waits, but then he starts to think that the
|
||||
bird may be hurt. After a couple of minutes of silence, he's so
|
||||
worried that he opens up the freezer door.
|
||||
|
||||
The bird calmly climbs onto the man's out-stretched arm and says,
|
||||
"Awfully sorry about the trouble I gave you. I'll do my best to
|
||||
improve my vocabulary from now on."
|
||||
|
||||
The man is astounded. He can't understand the transformation that
|
||||
has come over the parrot.
|
||||
|
||||
Then the parrot says, "By the way, what did the chicken do?"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
Seldom we find," says Solomon Don Dunce,
|
||||
"Half an idea in the profoundest sonnet.
|
||||
Through all the flimsy things we see at once
|
||||
As easily as through a Naples bonnet —
|
||||
Trash of all trash! -- how can a lady don it?
|
||||
Yet heavier far than your Petrarchan stuff—
|
||||
Owl-downy nonsense that the faintest puff
|
||||
Twirls into trunk-paper the while you con it."
|
||||
And, veritably, Sol is right enough.
|
||||
The general Petrarchanities are arrant
|
||||
Bubbles -- ephemeral and so transparent --
|
||||
But this is, now, -- you may depend upon it --
|
||||
Stable, opaque, immortal -- all by dint
|
||||
Of the dear names that lie concealed within 't.
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
1,George,Washington,Westmoreland County,Virginia,no party
|
||||
2,John,Adams,"Braintree, Norfolk",Massachusetts,Federalist
|
||||
3,Thomas,Jefferson,Albermarle County,Virginia,Democratic - Republican
|
||||
4,James,Madison,Port Conway,Virginia,Democratic - Republican
|
||||
5,James,Monroe,Westmoreland County,Virginia,Democratic - Republican
|
||||
6,John Quincy,Adams,"Braintree, Norfolk",Massachusetts,Democratic - Republican
|
||||
7,Andrew,Jackson,Waxhaw,South Carolina,Democratic
|
||||
8,Martin,Van Buren,Kinderhook,New York,Democratic
|
||||
9,William Henry,Harrison,Berkeley,Virginia,Whig
|
||||
10,John,Tyler,Charles City County,Virginia,Whig
|
||||
11,James Knox,Polk,Mecklenburg County,North Carolina,Democratic
|
||||
12,Zachary,Taylor,Orange County,Virginia,Whig
|
||||
13,Millard,Fillmore,Cayuga County,New York,Whig
|
||||
14,Franklin,Pierce,Hillsboro,New Hampshire,Democratic
|
||||
15,James,Buchanan,Cove Gap,Pennsylvania,Democratic
|
||||
16,Abraham,Lincoln,"Hodgenville, Hardin County",Kentucky,Republican
|
||||
17,Andrew,Johnson,Raleigh,North Carolina,Republican
|
||||
18,Ulysses Simpson,Grant,Point Pleasant,Ohio,Republican
|
||||
19,Rutherford Birchard,Hayes,Delaware,Ohio,Republican
|
||||
20,James Abram,Garfield,"Orange, Cuyahoga County",Ohio,Republican
|
||||
21,Chester Alan,Arthur,Fairfield,Vermont,Republican
|
||||
22,Grover,Cleveland,Caldwell,New Jersey,Democratic
|
||||
23,Benjamin,Harrison,North Bend,Ohio,Republican
|
||||
24,Grover,Cleveland,Caldwell,New Jersey,Democratic
|
||||
25,William,McKinley,Niles,Ohio,Republican
|
||||
26,Theodore,Roosevelt,New York City,New York,Republican
|
||||
27,William Howard,Taft,Cincinnati,Ohio,Republican
|
||||
28,Woodrow,Wilson,Staunton,Virginia,Democratic
|
||||
29,Warren Gamaliel,Harding,Blooming Grove,Ohio,Republican
|
||||
30,Calvin,Coolidge,Plymouth,Vermont,Republican
|
||||
31,Herbert Clark,Hoover,West Branch,Iowa,Republican
|
||||
32,Franklin Delano,Roosevelt,Hyde Park,New York,Democratic
|
||||
33,Harry S.,Truman,Lamar,Missouri,Democratic
|
||||
34,Dwight David,Eisenhower,Denison,Texas,Republican
|
||||
35,John Fitzgerald,Kennedy,Brookline,Massachusetts,Democratic
|
||||
36,Lyndon Baines,Johnson,near Stonewall,Texas,Democratic
|
||||
37,Richard Milhous,Nixon,Yorba Linda,California,Republican
|
||||
38,Gerald Rudolph,Ford,Omaha,Nebraska,Republican
|
||||
39,James Earl 'Jimmy',Carter,Plains,Georgia,Democratic
|
||||
40,Ronald Wilson,Reagan,Tampico,Illinois,Republican
|
||||
41,George Herbert Walker,Bush,Milton,Massachusetts,Republican
|
||||
42,William Jefferson 'Bill',Clinton,Hope,Arkansas,Democratic
|
||||
43,George Walker,Bush,New Haven,Connecticut,Republican
|
||||
44,Barack Hussein,Obama,Honolulu,Hawaii,Democratic
|
||||
45,Donald John,Trump,"Queens, NYC",New York,Republican
|
||||
46,Joseph Robinette,Biden,Scranton,Pennsylvania,Democratic
|
||||
|
Binary file not shown.
@@ -0,0 +1,604 @@
|
||||
|
||||
{
|
||||
"presidents":[
|
||||
|
||||
{
|
||||
"termnum":1,
|
||||
"lastname":"Washington",
|
||||
"firstname":"George",
|
||||
"dstart":"1789-04-30",
|
||||
"dend":"1797-03-04",
|
||||
"birthplace":"Westmoreland County",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1732-02-22",
|
||||
"ddeath":"1799-12-14",
|
||||
"party":"no party"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":2,
|
||||
"lastname":"Adams",
|
||||
"firstname":"John",
|
||||
"dstart":"1797-03-04",
|
||||
"dend":"1801-03-04",
|
||||
"birthplace":"Braintree, Norfolk",
|
||||
"birthstate":"Massachusetts",
|
||||
"dbirth":"1735-10-30",
|
||||
"ddeath":"1826-07-04",
|
||||
"party":"Federalist"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":3,
|
||||
"lastname":"Jefferson",
|
||||
"firstname":"Thomas",
|
||||
"dstart":"1801-03-04",
|
||||
"dend":"1809-03-04",
|
||||
"birthplace":"Albermarle County",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1743-04-13",
|
||||
"ddeath":"1826-07-04",
|
||||
"party":"Democratic - Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":4,
|
||||
"lastname":"Madison",
|
||||
"firstname":"James",
|
||||
"dstart":"1809-03-04",
|
||||
"dend":"1817-03-04",
|
||||
"birthplace":"Port Conway",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1751-03-16",
|
||||
"ddeath":"1836-06-28",
|
||||
"party":"Democratic - Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":5,
|
||||
"lastname":"Monroe",
|
||||
"firstname":"James",
|
||||
"dstart":"1817-03-04",
|
||||
"dend":"1825-03-04",
|
||||
"birthplace":"Westmoreland County",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1758-04-28",
|
||||
"ddeath":"1831-07-04",
|
||||
"party":"Democratic - Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":6,
|
||||
"lastname":"Adams",
|
||||
"firstname":"John Quincy",
|
||||
"dstart":"1825-03-04",
|
||||
"dend":"1829-03-04",
|
||||
"birthplace":"Braintree, Norfolk",
|
||||
"birthstate":"Massachusetts",
|
||||
"dbirth":"1767-07-11",
|
||||
"ddeath":"1848-02-23",
|
||||
"party":"Democratic - Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":7,
|
||||
"lastname":"Jackson",
|
||||
"firstname":"Andrew",
|
||||
"dstart":"1829-03-04",
|
||||
"dend":"1837-03-04",
|
||||
"birthplace":"Waxhaw",
|
||||
"birthstate":"South Carolina",
|
||||
"dbirth":"1767-03-15",
|
||||
"ddeath":"1845-06-08",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":8,
|
||||
"lastname":"Van Buren",
|
||||
"firstname":"Martin",
|
||||
"dstart":"1837-03-04",
|
||||
"dend":"1841-03-04",
|
||||
"birthplace":"Kinderhook",
|
||||
"birthstate":"New York",
|
||||
"dbirth":"1782-12-05",
|
||||
"ddeath":"1862-07-24",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":9,
|
||||
"lastname":"Harrison",
|
||||
"firstname":"William Henry",
|
||||
"dstart":"1841-03-04",
|
||||
"dend":"1841-04-04",
|
||||
"birthplace":"Berkeley",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1773-02-09",
|
||||
"ddeath":"1841-04-04",
|
||||
"party":"Whig"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":10,
|
||||
"lastname":"Tyler",
|
||||
"firstname":"John",
|
||||
"dstart":"1841-04-04",
|
||||
"dend":"1845-03-04",
|
||||
"birthplace":"Charles City County",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1790-03-29",
|
||||
"ddeath":"1862-01-18",
|
||||
"party":"Whig"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":11,
|
||||
"lastname":"Polk",
|
||||
"firstname":"James Knox",
|
||||
"dstart":"1845-03-04",
|
||||
"dend":"1849-03-03",
|
||||
"birthplace":"Mecklenburg County",
|
||||
"birthstate":"North Carolina",
|
||||
"dbirth":"1795-11-02",
|
||||
"ddeath":"1849-06-15",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":12,
|
||||
"lastname":"Taylor",
|
||||
"firstname":"Zachary",
|
||||
"dstart":"1849-03-05",
|
||||
"dend":"1850-07-09",
|
||||
"birthplace":"Orange County",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1784-11-24",
|
||||
"ddeath":"1850-07-09",
|
||||
"party":"Whig"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":13,
|
||||
"lastname":"Fillmore",
|
||||
"firstname":"Millard",
|
||||
"dstart":"1850-07-09",
|
||||
"dend":"1853-03-04",
|
||||
"birthplace":"Cayuga County",
|
||||
"birthstate":"New York",
|
||||
"dbirth":"1800-01-07",
|
||||
"ddeath":"1874-03-08",
|
||||
"party":"Whig"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":14,
|
||||
"lastname":"Pierce",
|
||||
"firstname":"Franklin",
|
||||
"dstart":"1853-03-04",
|
||||
"dend":"1857-03-04",
|
||||
"birthplace":"Hillsboro",
|
||||
"birthstate":"New Hampshire",
|
||||
"dbirth":"1804-11-23",
|
||||
"ddeath":"1869-10-08",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":15,
|
||||
"lastname":"Buchanan",
|
||||
"firstname":"James",
|
||||
"dstart":"1857-03-04",
|
||||
"dend":"1861-03-04",
|
||||
"birthplace":"Cove Gap",
|
||||
"birthstate":"Pennsylvania",
|
||||
"dbirth":"1791-04-23",
|
||||
"ddeath":"1868-06-01",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":16,
|
||||
"lastname":"Lincoln",
|
||||
"firstname":"Abraham",
|
||||
"dstart":"1861-03-04",
|
||||
"dend":"1865-04-15",
|
||||
"birthplace":"Hodgenville, Hardin County",
|
||||
"birthstate":"Kentucky",
|
||||
"dbirth":"1809-02-12",
|
||||
"ddeath":"1865-04-15",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":17,
|
||||
"lastname":"Johnson",
|
||||
"firstname":"Andrew",
|
||||
"dstart":"1865-04-15",
|
||||
"dend":"1869-03-04",
|
||||
"birthplace":"Raleigh",
|
||||
"birthstate":"North Carolina",
|
||||
"dbirth":"1808-12-29",
|
||||
"ddeath":"1875-07-31",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":18,
|
||||
"lastname":"Grant",
|
||||
"firstname":"Ulysses Simpson",
|
||||
"dstart":"1869-03-04",
|
||||
"dend":"1877-03-04",
|
||||
"birthplace":"Point Pleasant",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1822-04-27",
|
||||
"ddeath":"1885-07-23",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":19,
|
||||
"lastname":"Hayes",
|
||||
"firstname":"Rutherford Birchard",
|
||||
"dstart":"1877-03-04",
|
||||
"dend":"1881-03-04",
|
||||
"birthplace":"Delaware",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1822-10-04",
|
||||
"ddeath":"1893-01-17",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":20,
|
||||
"lastname":"Garfield",
|
||||
"firstname":"James Abram",
|
||||
"dstart":"1881-03-04",
|
||||
"dend":"1881-09-19",
|
||||
"birthplace":"Orange, Cuyahoga County",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1831-11-19",
|
||||
"ddeath":"1881-09-19",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":21,
|
||||
"lastname":"Arthur",
|
||||
"firstname":"Chester Alan",
|
||||
"dstart":"1881-09-20",
|
||||
"dend":"1885-03-04",
|
||||
"birthplace":"Fairfield",
|
||||
"birthstate":"Vermont",
|
||||
"dbirth":"1829-10-05",
|
||||
"ddeath":"1886-11-18",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":22,
|
||||
"lastname":"Cleveland",
|
||||
"firstname":"Grover",
|
||||
"dstart":"1885-03-04",
|
||||
"dend":"1889-03-04",
|
||||
"birthplace":"Caldwell",
|
||||
"birthstate":"New Jersey",
|
||||
"dbirth":"1837-03-18",
|
||||
"ddeath":"1908-06-24",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":23,
|
||||
"lastname":"Harrison",
|
||||
"firstname":"Benjamin",
|
||||
"dstart":"1889-03-04",
|
||||
"dend":"1893-03-04",
|
||||
"birthplace":"North Bend",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1833-08-20",
|
||||
"ddeath":"1901-03-13",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":24,
|
||||
"lastname":"Cleveland",
|
||||
"firstname":"Grover",
|
||||
"dstart":"1893-03-04",
|
||||
"dend":"1897-03-04",
|
||||
"birthplace":"Caldwell",
|
||||
"birthstate":"New Jersey",
|
||||
"dbirth":"1837-03-18",
|
||||
"ddeath":"1908-06-24",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":25,
|
||||
"lastname":"McKinley",
|
||||
"firstname":"William",
|
||||
"dstart":"1897-03-04",
|
||||
"dend":"1901-09-14",
|
||||
"birthplace":"Niles",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1843-01-29",
|
||||
"ddeath":"1901-09-14",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":26,
|
||||
"lastname":"Roosevelt",
|
||||
"firstname":"Theodore",
|
||||
"dstart":"1901-09-14",
|
||||
"dend":"1909-03-04",
|
||||
"birthplace":"New York City",
|
||||
"birthstate":"New York",
|
||||
"dbirth":"1858-10-27",
|
||||
"ddeath":"1919-01-06",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":27,
|
||||
"lastname":"Taft",
|
||||
"firstname":"William Howard",
|
||||
"dstart":"1909-03-04",
|
||||
"dend":"1913-03-04",
|
||||
"birthplace":"Cincinnati",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1857-09-15",
|
||||
"ddeath":"1930-03-08",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":28,
|
||||
"lastname":"Wilson",
|
||||
"firstname":"Woodrow",
|
||||
"dstart":"1913-03-04",
|
||||
"dend":"1921-03-04",
|
||||
"birthplace":"Staunton",
|
||||
"birthstate":"Virginia",
|
||||
"dbirth":"1856-12-28",
|
||||
"ddeath":"1924-02-03",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":29,
|
||||
"lastname":"Harding",
|
||||
"firstname":"Warren Gamaliel",
|
||||
"dstart":"1921-03-04",
|
||||
"dend":"1923-08-02",
|
||||
"birthplace":"Blooming Grove",
|
||||
"birthstate":"Ohio",
|
||||
"dbirth":"1865-11-02",
|
||||
"ddeath":"1923-08-02",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":30,
|
||||
"lastname":"Coolidge",
|
||||
"firstname":"Calvin",
|
||||
"dstart":"1923-08-03",
|
||||
"dend":"1929-03-04",
|
||||
"birthplace":"Plymouth",
|
||||
"birthstate":"Vermont",
|
||||
"dbirth":"1872-07-04",
|
||||
"ddeath":"1933-01-05",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":31,
|
||||
"lastname":"Hoover",
|
||||
"firstname":"Herbert Clark",
|
||||
"dstart":"1929-03-04",
|
||||
"dend":"1933-03-04",
|
||||
"birthplace":"West Branch",
|
||||
"birthstate":"Iowa",
|
||||
"dbirth":"1874-08-10",
|
||||
"ddeath":"1964-10-20",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":32,
|
||||
"lastname":"Roosevelt",
|
||||
"firstname":"Franklin Delano",
|
||||
"dstart":"1933-03-04",
|
||||
"dend":"1945-04-12",
|
||||
"birthplace":"Hyde Park",
|
||||
"birthstate":"New York",
|
||||
"dbirth":"1882-01-30",
|
||||
"ddeath":"1945-04-12",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":33,
|
||||
"lastname":"Truman",
|
||||
"firstname":"Harry S.",
|
||||
"dstart":"1945-04-12",
|
||||
"dend":"1953-01-20",
|
||||
"birthplace":"Lamar",
|
||||
"birthstate":"Missouri",
|
||||
"dbirth":"1884-05-08",
|
||||
"ddeath":"1972-12-26",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":34,
|
||||
"lastname":"Eisenhower",
|
||||
"firstname":"Dwight David",
|
||||
"dstart":"1953-01-20",
|
||||
"dend":"1961-01-20",
|
||||
"birthplace":"Denison",
|
||||
"birthstate":"Texas",
|
||||
"dbirth":"1890-10-14",
|
||||
"ddeath":"1969-03-28",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":35,
|
||||
"lastname":"Kennedy",
|
||||
"firstname":"John Fitzgerald",
|
||||
"dstart":"1961-01-20",
|
||||
"dend":"1963-11-22",
|
||||
"birthplace":"Brookline",
|
||||
"birthstate":"Massachusetts",
|
||||
"dbirth":"1917-05-29",
|
||||
"ddeath":"1963-11-22",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":36,
|
||||
"lastname":"Johnson",
|
||||
"firstname":"Lyndon Baines",
|
||||
"dstart":"1963-11-22",
|
||||
"dend":"1969-01-20",
|
||||
"birthplace":"near Stonewall",
|
||||
"birthstate":"Texas",
|
||||
"dbirth":"1908-08-27",
|
||||
"ddeath":"1973-01-22",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":37,
|
||||
"lastname":"Nixon",
|
||||
"firstname":"Richard Milhous",
|
||||
"dstart":"1969-01-20",
|
||||
"dend":"1974-08-09",
|
||||
"birthplace":"Yorba Linda",
|
||||
"birthstate":"California",
|
||||
"dbirth":"1913-01-09",
|
||||
"ddeath":"1994-04-22",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":38,
|
||||
"lastname":"Ford",
|
||||
"firstname":"Gerald Rudolph",
|
||||
"dstart":"1974-08-09",
|
||||
"dend":"1977-01-20",
|
||||
"birthplace":"Omaha",
|
||||
"birthstate":"Nebraska",
|
||||
"dbirth":"1913-07-14",
|
||||
"ddeath":"2006-12-26",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":39,
|
||||
"lastname":"Carter",
|
||||
"firstname":"James Earl 'Jimmy'",
|
||||
"dstart":"1977-01-20",
|
||||
"dend":"1981-01-20",
|
||||
"birthplace":"Plains",
|
||||
"birthstate":"Georgia",
|
||||
"dbirth":"1924-10-01",
|
||||
"ddeath":"None",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":40,
|
||||
"lastname":"Reagan",
|
||||
"firstname":"Ronald Wilson",
|
||||
"dstart":"1981-01-20",
|
||||
"dend":"1989-01-20",
|
||||
"birthplace":"Tampico",
|
||||
"birthstate":"Illinois",
|
||||
"dbirth":"1911-02-06",
|
||||
"ddeath":"2004-06-05",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":41,
|
||||
"lastname":"Bush",
|
||||
"firstname":"George Herbert Walker",
|
||||
"dstart":"1989-01-20",
|
||||
"dend":"1993-01-20",
|
||||
"birthplace":"Milton",
|
||||
"birthstate":"Massachusetts",
|
||||
"dbirth":"1924-06-12",
|
||||
"ddeath":"2018-11-30",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":42,
|
||||
"lastname":"Clinton",
|
||||
"firstname":"William Jefferson 'Bill'",
|
||||
"dstart":"1993-01-20",
|
||||
"dend":"2001-01-20",
|
||||
"birthplace":"Hope",
|
||||
"birthstate":"Arkansas",
|
||||
"dbirth":"1946-08-19",
|
||||
"ddeath":"None",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":43,
|
||||
"lastname":"Bush",
|
||||
"firstname":"George Walker",
|
||||
"dstart":"2001-01-20",
|
||||
"dend":"2009-01-20",
|
||||
"birthplace":"New Haven",
|
||||
"birthstate":"Connecticut",
|
||||
"dbirth":"1946-07-06",
|
||||
"ddeath":"None",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":44,
|
||||
"lastname":"Obama",
|
||||
"firstname":"Barack Hussein",
|
||||
"dstart":"2009-01-20",
|
||||
"dend":"2017-01-20",
|
||||
"birthplace":"Honolulu",
|
||||
"birthstate":"Hawaii",
|
||||
"dbirth":"1961-08-04",
|
||||
"ddeath":"None",
|
||||
"party":"Democratic"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":45,
|
||||
"lastname":"Trump",
|
||||
"firstname":"Donald J",
|
||||
"dstart":"2017-01-20",
|
||||
"dend":"2021-01-20",
|
||||
"birthplace":"Queens, NYC",
|
||||
"birthstate":"New York",
|
||||
"dbirth":"1946-06-14",
|
||||
"ddeath":"None",
|
||||
"party":"Republican"
|
||||
},
|
||||
|
||||
{
|
||||
"termnum":46,
|
||||
"lastname":"Biden",
|
||||
"firstname":"Joseph Robinette",
|
||||
"dstart":"2021-01-20",
|
||||
"dend":"None",
|
||||
"birthplace":"Scranton",
|
||||
"birthstate":"Pennsylvania",
|
||||
"dbirth":"1942-11-10",
|
||||
"ddeath":"None",
|
||||
"party":"Democratic"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
1:Washington:George:1732-02-22:1799-12-14:Westmoreland County:Virginia:1789-04-30:1797-03-04:no party
|
||||
2:Adams:John:1735-10-30:1826-07-04:Braintree, Norfolk:Massachusetts:1797-03-04:1801-03-04:Federalist
|
||||
3:Jefferson:Thomas:1743-04-13:1826-07-04:Albermarle County:Virginia:1801-03-04:1809-03-04:Democratic - Republican
|
||||
4:Madison:James:1751-03-16:1836-06-28:Port Conway:Virginia:1809-03-04:1817-03-04:Democratic - Republican
|
||||
5:Monroe:James:1758-04-28:1831-07-04:Westmoreland County:Virginia:1817-03-04:1825-03-04:Democratic - Republican
|
||||
6:Adams:John Quincy:1767-07-11:1848-02-23:Braintree, Norfolk:Massachusetts:1825-03-04:1829-03-04:Democratic - Republican
|
||||
7:Jackson:Andrew:1767-03-15:1845-06-08:Waxhaw:South Carolina:1829-03-04:1837-03-04:Democratic
|
||||
8:Van Buren:Martin:1782-12-05:1862-07-24:Kinderhook:New York:1837-03-04:1841-03-04:Democratic
|
||||
9:Harrison:William Henry:1773-02-09:1841-04-04:Berkeley:Virginia:1841-03-04:1841-04-04:Whig
|
||||
10:Tyler:John:1790-03-29:1862-01-18:Charles City County:Virginia:1841-04-04:1845-03-04:Whig
|
||||
11:Polk:James Knox:1795-11-02:1849-06-15:Mecklenburg County:North Carolina:1845-03-04:1849-03-03:Democratic
|
||||
12:Taylor:Zachary:1784-11-24:1850-07-09:Orange County:Virginia:1849-03-05:1850-07-09:Whig
|
||||
13:Fillmore:Millard:1800-01-07:1874-03-08:Cayuga County:New York:1850-07-09:1853-03-04:Whig
|
||||
14:Pierce:Franklin:1804-11-23:1869-10-08:Hillsboro:New Hampshire:1853-03-04:1857-03-04:Democratic
|
||||
15:Buchanan:James:1791-04-23:1868-06-01:Cove Gap:Pennsylvania:1857-03-04:1861-03-04:Democratic
|
||||
16:Lincoln:Abraham:1809-02-12:1865-04-15:Hodgenville, Hardin County:Kentucky:1861-03-04:1865-04-15:Republican
|
||||
17:Johnson:Andrew:1808-12-29:1875-07-31:Raleigh:North Carolina:1865-04-15:1869-03-04:Republican
|
||||
18:Grant:Ulysses Simpson:1822-04-27:1885-07-23:Point Pleasant:Ohio:1869-03-04:1877-03-04:Republican
|
||||
19:Hayes:Rutherford Birchard:1822-10-04:1893-01-17:Delaware:Ohio:1877-03-04:1881-03-04:Republican
|
||||
20:Garfield:James Abram:1831-11-19:1881-09-19:Orange, Cuyahoga County:Ohio:1881-03-04:1881-09-19:Republican
|
||||
21:Arthur:Chester Alan:1829-10-05:1886-11-18:Fairfield:Vermont:1881-09-20:1885-03-04:Republican
|
||||
22:Cleveland:Grover:1837-03-18:1908-06-24:Caldwell:New Jersey:1885-03-04:1889-03-04:Democratic
|
||||
23:Harrison:Benjamin:1833-08-20:1901-03-13:North Bend:Ohio:1889-03-04:1893-03-04:Republican
|
||||
24:Cleveland:Grover:1837-03-18:1908-06-24:Caldwell:New Jersey:1893-03-04:1897-03-04:Democratic
|
||||
25:McKinley:William:1843-01-29:1901-09-14:Niles:Ohio:1897-03-04:1901-09-14:Republican
|
||||
26:Roosevelt:Theodore:1858-10-27:1919-01-06:New York City:New York:1901-09-14:1909-03-04:Republican
|
||||
27:Taft:William Howard:1857-09-15:1930-03-08:Cincinnati:Ohio:1909-03-04:1913-03-04:Republican
|
||||
28:Wilson:Woodrow:1856-12-28:1924-02-03:Staunton:Virginia:1913-03-04:1921-03-04:Democratic
|
||||
29:Harding:Warren Gamaliel:1865-11-02:1923-08-02:Blooming Grove:Ohio:1921-03-04:1923-08-02:Republican
|
||||
30:Coolidge:Calvin:1872-07-04:1933-01-05:Plymouth:Vermont:1923-08-03:1929-03-04:Republican
|
||||
31:Hoover:Herbert Clark:1874-08-10:1964-10-20:West Branch:Iowa:1929-03-04:1933-03-04:Republican
|
||||
32:Roosevelt:Franklin Delano:1882-01-30:1945-04-12:Hyde Park:New York:1933-03-04:1945-04-12:Democratic
|
||||
33:Truman:Harry S.:1884-05-08:1972-12-26:Lamar:Missouri:1945-04-12:1953-01-20:Democratic
|
||||
34:Eisenhower:Dwight David:1890-10-14:1969-03-28:Denison:Texas:1953-01-20:1961-01-20:Republican
|
||||
35:Kennedy:John Fitzgerald:1917-05-29:1963-11-22:Brookline:Massachusetts:1961-01-20:1963-11-22:Democratic
|
||||
36:Johnson:Lyndon Baines:1908-08-27:1973-01-22:near Stonewall:Texas:1963-11-22:1969-01-20:Democratic
|
||||
37:Nixon:Richard Milhous:1913-01-09:1994-04-22:Yorba Linda:California:1969-01-20:1974-08-09:Republican
|
||||
38:Ford:Gerald Rudolph:1913-07-14:2006-12-26:Omaha:Nebraska:1974-08-09:1977-01-20:Republican
|
||||
39:Carter:James Earl 'Jimmy':1924-10-01:NONE:Plains:Georgia:1977-01-20:1981-01-20:Democratic
|
||||
40:Reagan:Ronald Wilson:1911-02-06:2004-06-05:Tampico:Illinois:1981-01-20:1989-01-20:Republican
|
||||
41:Bush:George Herbert Walker:1924-06-12:2018-11-30:Milton:Massachusetts:1989-01-20:1993-01-20:Republican
|
||||
42:Clinton:William Jefferson 'Bill':1946-08-19:NONE:Hope:Arkansas:1993-01-20:2001-01-20:Democratic
|
||||
43:Bush:George Walker:1946-07-06:NONE:New Haven:Connecticut:2001-01-20:2009-01-20:Republican
|
||||
44:Obama:Barack Hussein:1961-08-04:NONE:Honolulu:Hawaii:2009-01-20:2017-01-20:Democratic
|
||||
45:Trump:Donald John:1946-06-14:NONE:Queens, NYC:New York:2017-01-20:2021-01-20:Republican
|
||||
46:Biden:Joseph Robinette:1942-11-10:NONE:Scranton:Pennsylvania:2021-01-20:NONE:Democratic
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,460 @@
|
||||
- term: 1
|
||||
lastname: Washington
|
||||
firstname: George
|
||||
birthdate: 1732-02-22
|
||||
deathdate: 1799-12-14
|
||||
birthplace: Westmoreland County
|
||||
birthstate: Virginia
|
||||
termstart: 1789-04-30
|
||||
termend: 1797-03-04
|
||||
party: None
|
||||
- term: 2
|
||||
lastname: Adams
|
||||
firstname: John
|
||||
birthdate: 1735-10-30
|
||||
deathdate: 1826-07-04
|
||||
birthplace: Braintree, Norfolk
|
||||
birthstate: Massachusetts
|
||||
termstart: 1797-03-04
|
||||
termend: 1801-03-04
|
||||
party: Federalist
|
||||
- term: 3
|
||||
lastname: Jefferson
|
||||
firstname: Thomas
|
||||
birthdate: 1743-04-13
|
||||
deathdate: 1826-07-04
|
||||
birthplace: Albermarle County
|
||||
birthstate: Virginia
|
||||
termstart: 1801-03-04
|
||||
termend: 1809-03-04
|
||||
party: Democratic - Republican
|
||||
- term: 4
|
||||
lastname: Madison
|
||||
firstname: James
|
||||
birthdate: 1751-03-16
|
||||
deathdate: 1836-06-28
|
||||
birthplace: Port Conway
|
||||
birthstate: Virginia
|
||||
termstart: 1809-03-04
|
||||
termend: 1817-03-04
|
||||
party: Democratic - Republican
|
||||
- term: 5
|
||||
lastname: Monroe
|
||||
firstname: James
|
||||
birthdate: 1758-04-28
|
||||
deathdate: 1831-07-04
|
||||
birthplace: Westmoreland County
|
||||
birthstate: Virginia
|
||||
termstart: 1817-03-04
|
||||
termend: 1825-03-04
|
||||
party: Democratic - Republican
|
||||
- term: 6
|
||||
lastname: Adams
|
||||
firstname: John Quincy
|
||||
birthdate: 1767-07-11
|
||||
deathdate: 1848-02-23
|
||||
birthplace: Braintree, Norfolk
|
||||
birthstate: Massachusetts
|
||||
termstart: 1825-03-04
|
||||
termend: 1829-03-04
|
||||
party: Democratic - Republican
|
||||
- term: 7
|
||||
lastname: Jackson
|
||||
firstname: Andrew
|
||||
birthdate: 1767-03-15
|
||||
deathdate: 1845-06-08
|
||||
birthplace: Waxhaw
|
||||
birthstate: South Carolina
|
||||
termstart: 1829-03-04
|
||||
termend: 1837-03-04
|
||||
party: Democratic
|
||||
- term: 8
|
||||
lastname: Van Buren
|
||||
firstname: Martin
|
||||
birthdate: 1782-12-05
|
||||
deathdate: 1862-07-24
|
||||
birthplace: Kinderhook
|
||||
birthstate: New York
|
||||
termstart: 1837-03-04
|
||||
termend: 1841-03-04
|
||||
party: Democratic
|
||||
- term: 9
|
||||
lastname: Harrison
|
||||
firstname: William Henry
|
||||
birthdate: 1773-02-09
|
||||
deathdate: 1841-04-04
|
||||
birthplace: Berkeley
|
||||
birthstate: Virginia
|
||||
termstart: 1841-03-04
|
||||
termend: 1841-04-04
|
||||
party: Whig
|
||||
- term: 10
|
||||
lastname: Tyler
|
||||
firstname: John
|
||||
birthdate: 1790-03-29
|
||||
deathdate: 1862-01-18
|
||||
birthplace: Charles City County
|
||||
birthstate: Virginia
|
||||
termstart: 1841-04-04
|
||||
termend: 1845-03-04
|
||||
party: Whig
|
||||
- term: 11
|
||||
lastname: Polk
|
||||
firstname: James Knox
|
||||
birthdate: 1795-11-02
|
||||
deathdate: 1849-06-15
|
||||
birthplace: Mecklenburg County
|
||||
birthstate: North Carolina
|
||||
termstart: 1845-03-04
|
||||
termend: 1849-03-03
|
||||
party: Democratic
|
||||
- term: 12
|
||||
lastname: Taylor
|
||||
firstname: Zachary
|
||||
birthdate: 1784-11-24
|
||||
deathdate: 1850-07-09
|
||||
birthplace: Orange County
|
||||
birthstate: Virginia
|
||||
termstart: 1849-03-05
|
||||
termend: 1850-07-09
|
||||
party: Whig
|
||||
- term: 13
|
||||
lastname: Fillmore
|
||||
firstname: Millard
|
||||
birthdate: 1800-01-07
|
||||
deathdate: 1874-03-08
|
||||
birthplace: Cayuga County
|
||||
birthstate: New York
|
||||
termstart: 1850-07-09
|
||||
termend: 1853-03-04
|
||||
party: Whig
|
||||
- term: 14
|
||||
lastname: Pierce
|
||||
firstname: Franklin
|
||||
birthdate: 1804-11-23
|
||||
deathdate: 1869-10-08
|
||||
birthplace: Hillsboro
|
||||
birthstate: New Hampshire
|
||||
termstart: 1853-03-04
|
||||
termend: 1857-03-04
|
||||
party: Democratic
|
||||
- term: 15
|
||||
lastname: Buchanan
|
||||
firstname: James
|
||||
birthdate: 1791-04-23
|
||||
deathdate: 1868-06-01
|
||||
birthplace: Cove Gap
|
||||
birthstate: Pennsylvania
|
||||
termstart: 1857-03-04
|
||||
termend: 1861-03-04
|
||||
party: Democratic
|
||||
- term: 16
|
||||
lastname: Lincoln
|
||||
firstname: Abraham
|
||||
birthdate: 1809-02-12
|
||||
deathdate: 1865-04-15
|
||||
birthplace: Hodgenville, Hardin County
|
||||
birthstate: Kentucky
|
||||
termstart: 1861-03-04
|
||||
termend: 1865-04-15
|
||||
party: Republican
|
||||
- term: 17
|
||||
lastname: Johnson
|
||||
firstname: Andrew
|
||||
birthdate: 1808-12-29
|
||||
deathdate: 1875-07-31
|
||||
birthplace: Raleigh
|
||||
birthstate: North Carolina
|
||||
termstart: 1865-04-15
|
||||
termend: 1869-03-04
|
||||
party: Republican
|
||||
- term: 18
|
||||
lastname: Grant
|
||||
firstname: Ulysses Simpson
|
||||
birthdate: 1822-04-27
|
||||
deathdate: 1885-07-23
|
||||
birthplace: Point Pleasant
|
||||
birthstate: Ohio
|
||||
termstart: 1869-03-04
|
||||
termend: 1877-03-04
|
||||
party: Republican
|
||||
- term: 19
|
||||
lastname: Hayes
|
||||
firstname: Rutherford Birchard
|
||||
birthdate: 1822-10-04
|
||||
deathdate: 1893-01-17
|
||||
birthplace: Delaware
|
||||
birthstate: Ohio
|
||||
termstart: 1877-03-04
|
||||
termend: 1881-03-04
|
||||
party: Republican
|
||||
- term: 20
|
||||
lastname: Garfield
|
||||
firstname: James Abram
|
||||
birthdate: 1831-11-19
|
||||
deathdate: 1881-09-19
|
||||
birthplace: Orange, Cuyahoga County
|
||||
birthstate: Ohio
|
||||
termstart: 1881-03-04
|
||||
termend: 1881-09-19
|
||||
party: Republican
|
||||
- term: 21
|
||||
lastname: Arthur
|
||||
firstname: Chester Alan
|
||||
birthdate: 1829-10-05
|
||||
deathdate: 1886-11-18
|
||||
birthplace: Fairfield
|
||||
birthstate: Vermont
|
||||
termstart: 1881-09-20
|
||||
termend: 1885-03-04
|
||||
party: Republican
|
||||
- term: 22
|
||||
lastname: Cleveland
|
||||
firstname: Grover
|
||||
birthdate: 1837-03-18
|
||||
deathdate: 1908-06-24
|
||||
birthplace: Caldwell
|
||||
birthstate: New Jersey
|
||||
termstart: 1885-03-04
|
||||
termend: 1889-03-04
|
||||
party: Democratic
|
||||
- term: 23
|
||||
lastname: Harrison
|
||||
firstname: Benjamin
|
||||
birthdate: 1833-08-20
|
||||
deathdate: 1901-03-13
|
||||
birthplace: North Bend
|
||||
birthstate: Ohio
|
||||
termstart: 1889-03-04
|
||||
termend: 1893-03-04
|
||||
party: Republican
|
||||
- term: 24
|
||||
lastname: Cleveland
|
||||
firstname: Grover
|
||||
birthdate: 1837-03-18
|
||||
deathdate: 1908-06-24
|
||||
birthplace: Caldwell
|
||||
birthstate: New Jersey
|
||||
termstart: 1893-03-04
|
||||
termend: 1897-03-04
|
||||
party: Democratic
|
||||
- term: 25
|
||||
lastname: McKinley
|
||||
firstname: William
|
||||
birthdate: 1843-01-29
|
||||
deathdate: 1901-09-14
|
||||
birthplace: Niles
|
||||
birthstate: Ohio
|
||||
termstart: 1897-03-04
|
||||
termend: 1901-09-14
|
||||
party: Republican
|
||||
- term: 26
|
||||
lastname: Roosevelt
|
||||
firstname: Theodore
|
||||
birthdate: 1858-10-27
|
||||
deathdate: 1919-01-06
|
||||
birthplace: New York City
|
||||
birthstate: New York
|
||||
termstart: 1901-09-14
|
||||
termend: 1909-03-04
|
||||
party: Republican
|
||||
- term: 27
|
||||
lastname: Taft
|
||||
firstname: William Howard
|
||||
birthdate: 1857-09-15
|
||||
deathdate: 1930-03-08
|
||||
birthplace: Cincinnati
|
||||
birthstate: Ohio
|
||||
termstart: 1909-03-04
|
||||
termend: 1913-03-04
|
||||
party: Republican
|
||||
- term: 28
|
||||
lastname: Wilson
|
||||
firstname: Woodrow
|
||||
birthdate: 1856-12-28
|
||||
deathdate: 1924-02-03
|
||||
birthplace: Staunton
|
||||
birthstate: Virginia
|
||||
termstart: 1913-03-04
|
||||
termend: 1921-03-04
|
||||
party: Democratic
|
||||
- term: 29
|
||||
lastname: Harding
|
||||
firstname: Warren Gamaliel
|
||||
birthdate: 1865-11-02
|
||||
deathdate: 1923-08-02
|
||||
birthplace: Blooming Grove
|
||||
birthstate: Ohio
|
||||
termstart: 1921-03-04
|
||||
termend: 1923-08-02
|
||||
party: Republican
|
||||
- term: 30
|
||||
lastname: Coolidge
|
||||
firstname: Calvin
|
||||
birthdate: 1872-07-04
|
||||
deathdate: 1933-01-05
|
||||
birthplace: Plymouth
|
||||
birthstate: Vermont
|
||||
termstart: 1923-08-03
|
||||
termend: 1929-03-04
|
||||
party: Republican
|
||||
- term: 31
|
||||
lastname: Hoover
|
||||
firstname: Herbert Clark
|
||||
birthdate: 1874-08-10
|
||||
deathdate: 1964-10-20
|
||||
birthplace: West Branch
|
||||
birthstate: Iowa
|
||||
termstart: 1929-03-04
|
||||
termend: 1933-03-04
|
||||
party: Republican
|
||||
- term: 32
|
||||
lastname: Roosevelt
|
||||
firstname: Franklin Delano
|
||||
birthdate: 1882-01-30
|
||||
deathdate: 1945-04-12
|
||||
birthplace: Hyde Park
|
||||
birthstate: New York
|
||||
termstart: 1933-03-04
|
||||
termend: 1945-04-12
|
||||
party: Democratic
|
||||
- term: 33
|
||||
lastname: Truman
|
||||
firstname: Harry S.
|
||||
birthdate: 1884-05-08
|
||||
deathdate: 1972-12-26
|
||||
birthplace: Lamar
|
||||
birthstate: Missouri
|
||||
termstart: 1945-04-12
|
||||
termend: 1953-01-20
|
||||
party: Democratic
|
||||
- term: 34
|
||||
lastname: Eisenhower
|
||||
firstname: Dwight David
|
||||
birthdate: 1890-10-14
|
||||
deathdate: 1969-03-28
|
||||
birthplace: Denison
|
||||
birthstate: Texas
|
||||
termstart: 1953-01-20
|
||||
termend: 1961-01-20
|
||||
party: Republican
|
||||
- term: 35
|
||||
lastname: Kennedy
|
||||
firstname: John Fitzgerald
|
||||
birthdate: 1917-05-29
|
||||
deathdate: 1963-11-22
|
||||
birthplace: Brookline
|
||||
birthstate: Massachusetts
|
||||
termstart: 1961-01-20
|
||||
termend: 1963-11-22
|
||||
party: Democratic
|
||||
- term: 36
|
||||
lastname: Johnson
|
||||
firstname: Lyndon Baines
|
||||
birthdate: 1908-08-27
|
||||
deathdate: 1973-01-22
|
||||
birthplace: near Stonewall
|
||||
birthstate: Texas
|
||||
termstart: 1963-11-22
|
||||
termend: 1969-01-20
|
||||
party: Democratic
|
||||
- term: 37
|
||||
lastname: Nixon
|
||||
firstname: Richard Milhous
|
||||
birthdate: 1913-01-09
|
||||
deathdate: 1994-04-22
|
||||
birthplace: Yorba Linda
|
||||
birthstate: California
|
||||
termstart: 1969-01-20
|
||||
termend: 1974-08-09
|
||||
party: Republican
|
||||
- term: 38
|
||||
lastname: Ford
|
||||
firstname: Gerald Rudolph
|
||||
birthdate: 1913-07-14
|
||||
deathdate: 2006-12-26
|
||||
birthplace: Omaha
|
||||
birthstate: Nebraska
|
||||
termstart: 1974-08-09
|
||||
termend: 1977-01-20
|
||||
party: Republican
|
||||
- term: 39
|
||||
lastname: Carter
|
||||
firstname: James Earl 'Jimmy'
|
||||
birthdate: 1924-10-01
|
||||
deathdate: NONE
|
||||
birthplace: Plains
|
||||
birthstate: Georgia
|
||||
termstart: 1977-01-20
|
||||
termend: 1981-01-20
|
||||
party: Democratic
|
||||
- term: 40
|
||||
lastname: Reagan
|
||||
firstname: Ronald Wilson
|
||||
birthdate: 1911-02-06
|
||||
deathdate: 2004-06-05
|
||||
birthplace: Tampico
|
||||
birthstate: Illinois
|
||||
termstart: 1981-01-20
|
||||
termend: 1989-01-20
|
||||
party: Republican
|
||||
- term: 41
|
||||
lastname: Bush
|
||||
firstname: George Herbert Walker
|
||||
birthdate: 1924-06-12
|
||||
deathdate: None
|
||||
birthplace: Milton
|
||||
birthstate: Massachusetts
|
||||
termstart: 1989-01-20
|
||||
termend: 1993-01-20
|
||||
party: Republican
|
||||
- term: 42
|
||||
lastname: Clinton
|
||||
firstname: William Jefferson 'Bill'
|
||||
birthdate: 1946-08-19
|
||||
deathdate: None
|
||||
birthplace: Hope
|
||||
birthstate: Arkansas
|
||||
termstart: 1993-01-20
|
||||
termend: 2001-01-20
|
||||
party: Democratic
|
||||
- term: 43
|
||||
lastname: Bush
|
||||
firstname: George Walker
|
||||
birthdate: 1946-07-06
|
||||
deathdate: None
|
||||
birthplace: New Haven
|
||||
birthstate: Connecticut
|
||||
termstart: 2001-01-20
|
||||
termend: 2009-01-20
|
||||
party: Republican
|
||||
- term: 44
|
||||
lastname: Obama
|
||||
firstname: Barack Hussein
|
||||
birthdate: 1961-08-04
|
||||
deathdate: None
|
||||
birthplace: Honolulu
|
||||
birthstate: Hawaii
|
||||
termstart: 2009-01-20
|
||||
termend: 2017-01-20
|
||||
party: Democratic
|
||||
- term: 45
|
||||
lastname: Trump
|
||||
firstname: Donald John
|
||||
birthdate: 1946-06-14
|
||||
deathdate: None
|
||||
birthplace: Queens, NYC
|
||||
birthstate: New York
|
||||
termstart: 2017-01-20
|
||||
termend: 2021-01-20
|
||||
party: Republican
|
||||
- term: 46
|
||||
lastname: Biden
|
||||
firstname: Joseph Robinette
|
||||
birthdate: 1942-11-10
|
||||
deathdate: None
|
||||
birthplace: Scranton
|
||||
birthstate: Pennsylvania
|
||||
termstart: 2021-01-20
|
||||
termend: None
|
||||
party: Democratic
|
||||
@@ -0,0 +1,30 @@
|
||||
term,firstname,lastname,birthdate,deathdate,birthplace,tookoffice,leftoffice,party
|
||||
1,Sir John A.,Macdonald,1867-7-1,1873-11-5,"Glasgow, Scotland",1867-07-01,1873-11-05,Liberal-Conservative
|
||||
2,Alexander,Mackenzie,1873-11-7,1878-10-8,"Logierait, Scotland",1873-11-07,1878-10-08,Liberal
|
||||
3,Sir John A.,Macdonald,1878-10-17,1891-6-6,"Glasgow, Scotland",1878-10-17,1891-06-06,Liberal-Conservative
|
||||
4,Sir John,Albott,1891-6-16,1892-11-24,"Saint-Andre-d'Argenteuil, Quebec",1891-06-16,1892-11-24,Liberal-Conservative
|
||||
5,Thompson,Sir John,1892-12-5,1894-12-12,"Halifax, Nova Scotia",1892-12-05,1894-12-12,Conservative
|
||||
6,Sir Mackenzie,Bowell,1894-12-21,1896-4-27,"Rickinghall, England",1894-12-21,1896-04-27,Conservative
|
||||
7,Sir Charles,Tupper,1896-5-1,1896-7-8,"Amherst, Nova Scotia",1896-05-01,1896-07-08,Conservative
|
||||
8,Sir Wilfred,Laurier,1896-7-11,1911-10-6,"Saint-Lin-Laurentides, Quebec",1886-07-11,1911-10-06,Liberal
|
||||
9,Sir Robert,Borden,1911-10-10,1917-10-12,"Grand-Pre, Nova Scotia",1911-10-10,1917-10-11,Conservative
|
||||
10,Sir Robert,Borden,1917-10-12,1920-7-10,"Grand-Pre, Nova Scotia",1917-10-12,1920-07-10,Unionist
|
||||
11,Arthur,Meighen,1920-7-10,1921-12-29,"Perth South, Ontario",1920-07-10,1921-12-29,NLC
|
||||
12,William Lyon Mackenzie,King,1921-12-29,1926-6-29,"Kitchener, Ontario",1921-12-29,1926-06-28,Liberal
|
||||
13,Arthur,Meighen,1926-6-29,1926-9-25,"Perth South, Ontario",1926-06-29,1926-09-25,Conservative
|
||||
14,William Lyon Mackenzie,King,1926-9-25,1930-8-6,"Kitchener, Ontario",1926-09-25,1930-08-07,Liberal
|
||||
15,Richard Bedford,Bennett,1930-8-7,1935-10-23,"Hopewell Hill, New Brunswick",1930-08-07,1935-10-23,Conservative
|
||||
16,William Lyon Mackenzie,King,1935-10-23,1948-11-15,"Kitchener, Ontario",1935-10-23,1948-11-15,Liberal
|
||||
17,Louis,St. Laurent,1948-11-15,1957-6-21,"Compton, Quebec",1948-11-15,1957-06-21,Liberal
|
||||
18,John,Diefenbaker,1957-6-21,1963-4-22,"Neustadt, Ontario",1957-06-21,1963-04-22,Progressive Conservative
|
||||
19,Lester B.,Pearson,1963-4-22,1968-4-20,"Newtonbrook (Toronto), Ontario",1963-04-22,1968-04-20,Liberal
|
||||
20,Pierre,Trudeau,1968-4-20,1979-6-4,"Montreal, Quebec",1968-04-20,1979-06-03,Liberal
|
||||
21,Joe,Clark,1979-6-4,1980-3-3,"High River, Alberta",1979-06-04,1980-03-02,Progressive Conservative
|
||||
22,Pierre,Trudeau,1980-3-3,1984-6-30,"Montreal, Quebec",1980-03-03,1984-06-29,Liberal
|
||||
23,John,Turner,1984-6-30,1984-9-17,"Richmond, England",1984-06-30,1984-09-16,Liberal
|
||||
24,Brian,Mulroney,1984-9-17,1993-6-25,"Baie-Comeau, Quebec",1984-09-17,1993-06-24,Progressive Conservative
|
||||
25,Kim,Campbell,1993-6-25,1993-11-4,"Port Aberni, British Columbia",1993-06-25,1993-11-03,Progressive Conservative
|
||||
26,Jean,Chretien,1993-11-4,2003-12-12,"Shawnigan, Quebec",1993-11-04,2003-12-11,Liberal
|
||||
27,Paul,Martin,2003-12-12,2006-2-6,"Windsor, Ontario",2003-12-12,2006-02-05,Liberal
|
||||
28,Stephen,Harper,2006-2-6,2015-11-4,"Toronto, Ontario",2006-02-06,2015-11-03,Conservative
|
||||
29,Justin,Trudeau,2015-11-4,,"Ottawa, Ontario",2015-11-04,,Liberal
|
||||
|
@@ -0,0 +1,29 @@
|
||||
1:Sir John A.:Macdonald:1867-7-1:1873-11-5:Glasgow, Scotland:1867-07-01:1873-11-05:Liberal-Conservative
|
||||
2:Alexander:Mackenzie:1873-11-7:1878-10-8:Logierait, Scotland:1873-11-07:1878-10-08:Liberal
|
||||
3:Sir John A.:Macdonald:1878-10-17:1891-6-6:Glasgow, Scotland:1878-10-17:1891-06-06:Liberal-Conservative
|
||||
4:Sir John:Albott:1891-6-16:1892-11-24:Saint-Andre-d'Argenteuil, Quebec:1891-06-16:1892-11-24:Liberal-Conservative
|
||||
5:Thompson:Sir John:1892-12-5:1894-12-12:Halifax, Nova Scotia:1892-12-05:1894-12-12:Conservative
|
||||
6:Sir Mackenzie:Bowell:1894-12-21:1896-4-27:Rickinghall, England:1894-12-21:1896-04-27:Conservative
|
||||
7:Sir Charles:Tupper:1896-5-1:1896-7-8:Amherst, Nova Scotia:1896-05-01:1896-07-08:Conservative
|
||||
8:Sir Wilfred:Laurier:1896-7-11:1911-10-6:Saint-Lin-Laurentides, Quebec:1886-07-11:1911-10-06:Liberal
|
||||
9:Sir Robert:Borden:1911-10-10:1917-10-12:Grand-Pre, Nova Scotia:1911-10-10:1917-10-11:Conservative
|
||||
10:Sir Robert:Borden:1917-10-12:1920-7-10:Grand-Pre, Nova Scotia:1917-10-12:1920-07-10:Unionist
|
||||
11:Arthur:Meighen:1920-7-10:1921-12-29:Perth South, Ontario:1920-07-10:1921-12-29:NLC
|
||||
12:William Lyon Mackenzie:King:1921-12-29:1926-6-29:Kitchener, Ontario:1921-12-29:1926-06-28:Liberal
|
||||
13:Arthur:Meighen:1926-6-29:1926-9-25:Perth South, Ontario:1926-06-29:1926-09-25:Conservative
|
||||
14:William Lyon Mackenzie:King:1926-9-25:1930-8-6:Kitchener, Ontario:1926-09-25:1930-08-07:Liberal
|
||||
15:Richard Bedford:Bennett:1930-8-7:1935-10-23:Hopewell Hill, New Brunswick:1930-08-07:1935-10-23:Conservative
|
||||
16:William Lyon Mackenzie:King:1935-10-23:1948-11-15:Kitchener, Ontario:1935-10-23:1948-11-15:Liberal
|
||||
17:Louis:St. Laurent:1948-11-15:1957-6-21:Compton, Quebec:1948-11-15:1957-06-21:Liberal
|
||||
18:John:Diefenbaker:1957-6-21:1963-4-22:Neustadt, Ontario:1957-06-21:1963-04-22:Progressive Conservative
|
||||
19:Lester B.:Pearson:1963-4-22:1968-4-20:Newtonbrook (Toronto), Ontario:1963-04-22:1968-04-20:Liberal
|
||||
20:Pierre:Trudeau:1968-4-20:1979-6-4:Montreal, Quebec:1968-04-20:1979-06-03:Liberal
|
||||
21:Joe:Clark:1979-6-4:1980-3-3:High River, Alberta:1979-06-04:1980-03-02:Progressive Conservative
|
||||
22:Pierre:Trudeau:1980-3-3:1984-6-30:Montreal, Quebec:1980-03-03:1984-06-29:Liberal
|
||||
23:John:Turner:1984-6-30:1984-9-17:Richmond, England:1984-06-30:1984-09-16:Liberal
|
||||
24:Brian:Mulroney:1984-9-17:1993-6-25:Baie-Comeau, Quebec:1984-09-17:1993-06-24:Progressive Conservative
|
||||
25:Kim:Campbell:1993-6-25:1993-11-4:Port Aberni, British Columbia:1993-06-25:1993-11-03:Progressive Conservative
|
||||
26:Jean:Chretien:1993-11-4:2003-12-12:Shawnigan, Quebec:1993-11-04:2003-12-11:Liberal
|
||||
27:Paul:Martin:2003-12-12:2006-2-6:Windsor, Ontario:2003-12-12:2006-02-05:Liberal
|
||||
28:Stephen:Harper:2006-2-6:2015-11-4:Toronto, Ontario:2006-02-06:2015-11-03:Conservative
|
||||
29:Justin:Trudeau:2015-11-4:NONE:Ottawa, Ontario:2015-11-04:NONE:Liberal
|
||||
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"star": "Sun",
|
||||
"innerplanets": [
|
||||
{
|
||||
"name":"Mercury",
|
||||
"moons": null
|
||||
},
|
||||
{
|
||||
"name":"Venus",
|
||||
"moons": null
|
||||
},
|
||||
{
|
||||
"name":"Earth",
|
||||
"moons": [
|
||||
"moon"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Mars",
|
||||
"moons": [
|
||||
"Deimos",
|
||||
"Phobos"
|
||||
]
|
||||
}
|
||||
],
|
||||
"asteroids": [
|
||||
"Ceres",
|
||||
"Pallas",
|
||||
"Juno",
|
||||
"Vesta"
|
||||
],
|
||||
"outerplanets": [
|
||||
{
|
||||
"name":"Jupiter",
|
||||
"moons": [
|
||||
"Metis",
|
||||
"Adrastea",
|
||||
"Amalthea",
|
||||
"Thebe",
|
||||
"Io",
|
||||
"Europa",
|
||||
"Gannymede",
|
||||
"Callista",
|
||||
"Themisto",
|
||||
"Himalia",
|
||||
"Lysithea",
|
||||
"Elara"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Saturn",
|
||||
"moons": [
|
||||
"Rhea",
|
||||
"Hyperion",
|
||||
"Titan",
|
||||
"Iapetus",
|
||||
"Mimas",
|
||||
"Enceladus",
|
||||
"Tethys",
|
||||
"Dione",
|
||||
"Enceladus"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Uranus",
|
||||
"moons": [
|
||||
"Ariel",
|
||||
"Umbriel",
|
||||
"Miranda",
|
||||
"Titania",
|
||||
"Oberon"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Neptune",
|
||||
"moons": [
|
||||
"Triton",
|
||||
"Nereid",
|
||||
"Proteus"
|
||||
]
|
||||
}
|
||||
],
|
||||
"dwarfplanets": [
|
||||
{
|
||||
"name":"Pluto",
|
||||
"moons":[
|
||||
"Charon",
|
||||
"Hydra",
|
||||
"Nix"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<solarsystem>
|
||||
<star>Sun</star>
|
||||
<innerplanets>
|
||||
<planet planetname="Mercury"/>
|
||||
<planet planetname="Venus"/>
|
||||
<planet planetname="Earth">
|
||||
<moon>Moon</moon>
|
||||
</planet>
|
||||
<planet planetname="Mars">
|
||||
<moon>Deimos</moon>
|
||||
<moon>Phobos</moon>
|
||||
</planet>
|
||||
</innerplanets>
|
||||
<asteroids>
|
||||
<asteroid >Ceres</asteroid>
|
||||
<asteroid >Pallas</asteroid>
|
||||
<asteroid >Juno</asteroid>
|
||||
<asteroid >Vesta</asteroid>
|
||||
</asteroids>
|
||||
<outerplanets>
|
||||
<planet planetname="Jupiter">
|
||||
<moon>Metis</moon>
|
||||
<moon>Adrastea</moon>
|
||||
<moon>Amalthea</moon>
|
||||
<moon>Thebe</moon>
|
||||
<moon>Io</moon>
|
||||
<moon>Europa</moon>
|
||||
<moon>Gannymede</moon>
|
||||
<moon>Callista</moon>
|
||||
<moon>Themisto</moon>
|
||||
<moon>Himalia</moon>
|
||||
<moon>Lysithea</moon>
|
||||
<moon>Elara</moon>
|
||||
</planet>
|
||||
<planet planetname="Saturn">
|
||||
<moon>Rhea</moon>
|
||||
<moon>Hyperion</moon>
|
||||
<moon>Titan</moon>
|
||||
<moon>Iapetus</moon>
|
||||
<moon>Mimas</moon>
|
||||
<moon>Enceladus</moon>
|
||||
<moon>Tethys</moon>
|
||||
<moon>Dione</moon>
|
||||
<moon>Enceladus</moon>
|
||||
</planet>
|
||||
<planet planetname="Uranus">
|
||||
<moon>Ariel</moon>
|
||||
<moon>Umbriel</moon>
|
||||
<moon>Miranda</moon>
|
||||
<moon>Titania</moon>
|
||||
<moon>Oberon</moon>
|
||||
</planet>
|
||||
<planet planetname="Neptune">
|
||||
<moon>Triton</moon>
|
||||
<moon>Nereid</moon>
|
||||
<moon>Proteus</moon>
|
||||
</planet>
|
||||
</outerplanets>
|
||||
<dwarfplanets>
|
||||
<planet planetname="Pluto">
|
||||
<moon>Charon</moon>
|
||||
<moon>Hydra</moon>
|
||||
<moon>Nix</moon>
|
||||
</planet>
|
||||
</dwarfplanets>
|
||||
</solarsystem>
|
||||
@@ -0,0 +1,67 @@
|
||||
star:
|
||||
Sun
|
||||
inner:
|
||||
- name: Mercury
|
||||
moons:
|
||||
- None
|
||||
- name: Venus
|
||||
moons:
|
||||
- None
|
||||
- name: Earth
|
||||
moons:
|
||||
- Moon
|
||||
- name: Mars
|
||||
moons:
|
||||
- Deimos
|
||||
- Phobos
|
||||
- Metis
|
||||
|
||||
asteroids:
|
||||
- Ceres
|
||||
- Pallas
|
||||
- Juno
|
||||
- Vesta
|
||||
|
||||
outer:
|
||||
- name: Jupiter
|
||||
moons:
|
||||
- Adrastea
|
||||
- Amalthea
|
||||
- Thebe
|
||||
- Io
|
||||
- Europa
|
||||
- Gannymede
|
||||
- Callista
|
||||
- Themisto
|
||||
- Himalia
|
||||
- Lysithea
|
||||
- Elara
|
||||
- name: Saturn
|
||||
moons:
|
||||
- Rhea
|
||||
- Hyperion
|
||||
- Titan
|
||||
- Iapetus
|
||||
- Mimas
|
||||
- Enceladus
|
||||
- Tethys
|
||||
- Dione
|
||||
- Enceladus
|
||||
- name: Uranus
|
||||
moons:
|
||||
- Ariel
|
||||
- Umbriel
|
||||
- Miranda
|
||||
- Titania
|
||||
- Oberon
|
||||
- name: Neptune
|
||||
moons:
|
||||
- Triton
|
||||
- Nereid
|
||||
- Proteus
|
||||
plutoid:
|
||||
- name: Pluto
|
||||
moons:
|
||||
- Charon
|
||||
- Hydra
|
||||
- Nix
|
||||
@@ -0,0 +1,13 @@
|
||||
SPAM may be famous now, but it wasn't always that way. Fact is, SPAM hails from some rather humble beginnings.
|
||||
|
||||
Flash back to Austin, Minnesota, in 1937.
|
||||
|
||||
You're right. There isn't much here, except for an ambitious company called Hormel.
|
||||
|
||||
These good folks are about to hit upon an amazing little recipe: a spicy ham packaged in a handy dandy 12-ounce can.
|
||||
|
||||
J. C. Hormel, then president, adds the crowning ingredient: He holds a contest to give the product a name as distinctive as its taste.
|
||||
|
||||
SPAM soars. In fact, in that very first year of production, it grabs 18 percent of the market.
|
||||
|
||||
Over 65 years years later, more than 6 billion cans of SPAM have been sold.
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
The Tyger
|
||||
|
||||
Tyger! Tyger! burning bright
|
||||
In the forests of the night,
|
||||
What immortal hand or eye
|
||||
Could frame thy fearful symmetry?
|
||||
|
||||
In what distant deeps or skies
|
||||
Burnt the fire of thine eyes?
|
||||
On what wings dare he aspire?
|
||||
What the hand dare seize the fire?
|
||||
|
||||
And what shoulder, & what art,
|
||||
Could twist the sinews of thy heart?
|
||||
And when thy heart began to beat,
|
||||
What dread hand? & what dread feet?
|
||||
|
||||
What the hammer? what the chain?
|
||||
In what furnace was thy brain?
|
||||
What the anvil? what dread grasp
|
||||
Dare its deadly terrors clasp?
|
||||
|
||||
When the stars threw down their spears
|
||||
And water'd heaven with their tears,
|
||||
Did he smile his work to see?
|
||||
Did he who made the Lamb make thee?
|
||||
|
||||
Tyger! Tyger! burning bright
|
||||
In the forests of the night,
|
||||
What immortal hand or eye
|
||||
Dare frame thy fearful symmetry?
|
||||
|
||||
by William Blake
|
||||
+173466
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
class Animal(metaclass=ABCMeta): # <1>
|
||||
|
||||
@abstractmethod # <2>
|
||||
def speak(self):
|
||||
pass
|
||||
|
||||
class Dog(Animal): # <3>
|
||||
def speak(self): # <4>
|
||||
print("woof! woof!")
|
||||
|
||||
class Cat(Animal): # <3>
|
||||
def speak(self): # <4>
|
||||
print("Meow meow meow")
|
||||
|
||||
class Duck(Animal): # <3>
|
||||
pass # <5>
|
||||
|
||||
d = Dog()
|
||||
d.speak()
|
||||
|
||||
c = Cat()
|
||||
c.speak()
|
||||
|
||||
try:
|
||||
d = Duck() # <6>
|
||||
d.speak()
|
||||
except TypeError as err:
|
||||
print(err)
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
from types import MethodType
|
||||
|
||||
class Dog(): # <1>
|
||||
pass
|
||||
|
||||
d1 = Dog() # <2>
|
||||
|
||||
def bark(self): # <3>
|
||||
print("Woof! woof!")
|
||||
|
||||
setattr(Dog, "bark", bark) # <4>
|
||||
|
||||
d2 = Dog() # <5>
|
||||
|
||||
d1.bark() # <6>
|
||||
d2.bark()
|
||||
|
||||
def wag(self): # <7>
|
||||
print("Wagging...")
|
||||
|
||||
setattr(d1, "wag", MethodType(wag, d1)) # <8>
|
||||
|
||||
d1.wag() # <9>
|
||||
try:
|
||||
d2.wag() # <10>
|
||||
except AttributeError as err:
|
||||
print(err)
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
class Animal():
|
||||
count = 0 # <1>
|
||||
|
||||
def __init__(self, species, name, sound):
|
||||
self._species = species
|
||||
self._name = name
|
||||
self._sound = sound
|
||||
Animal.count += 1
|
||||
|
||||
@property
|
||||
def species(self):
|
||||
return self._species
|
||||
|
||||
@classmethod
|
||||
def kill(cls):
|
||||
cls.count -= 1
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
def make_sound(self):
|
||||
print(self._sound)
|
||||
|
||||
@classmethod
|
||||
def remove(cls):
|
||||
cls.count -= 1 # <2>
|
||||
|
||||
@classmethod
|
||||
def zoo_size(cls): # <3>
|
||||
return cls.count
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
leo = Animal("African lion", "Leo", "Roarrrrrrr")
|
||||
garfield = Animal("cat", "Garfield", "Meowwwww")
|
||||
felix = Animal("cat", "Felix", "Meowwwww")
|
||||
|
||||
print(leo.name, "is a", leo.species, "--", end=' ')
|
||||
leo.make_sound()
|
||||
|
||||
print(garfield.name, "is a", garfield.species, "--", end=' ')
|
||||
garfield.make_sound()
|
||||
|
||||
print(felix.name, "is a", felix.species, "--", end=' ')
|
||||
felix.make_sound()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user