This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "parser.py", line 42, in <module> | |
for n, r in enumerate(records(argv[1])): # 'My Clippings.txt') ): | |
File "parser.py", line 23, in records | |
clip['type'], clip['location'], clip['dow'], clip['date'], clip['time'] = match.groups() | |
AttributeError: 'NoneType' object has no attribute 'groups' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import codecs | |
from pprint import pprint | |
EOR = u"==========" | |
def records(file_path): | |
clip_file = codecs.open(file_path) | |
clip_file.seek(3) # skip magic cookie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0{'attribution': [u'Mark Pilgrim'], | |
'body': u"You KNOW HOW OTHER books go on and on about programming fundamentals, and finally work up to building a complete, working program? Let's skip all that.\n", | |
'date': u'June 13, 2011', | |
'dow': u'Monday', | |
'location': u'218-19', | |
'time': u'09:54 PM', | |
'title': u'Dive Into Python', | |
'type': u'Highlight on Page 11 |'} | |
1{'attribution': [u'Mark Pilgrim'], | |
'body': u'Often love this approach to learning, but appreciate context too.', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def talk_time(argv): | |
count = 0 | |
remaining = sum(argv) | |
for i in argv: | |
print("time elapsed: " + str(count)) | |
count += i | |
remaining -= i | |
print("after " + str(i) + "time remaining: " + str(remaining) + " ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
discussion = {} | |
discussion['John'] = 45 | |
discussion['Graham'] = 30 | |
discussion['Michael'] = 20 | |
discussion['Terry'] = 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from sys import argv | |
from bs4 import BeautifulSoup | |
script, landing = argv # landing is the first URI for this script | |
def extractor(landing): # extractor uses requests to GET pages | |
r = requests.get(landing) # and assigns them variables for use | |
response = r.status_code | |
c = r.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Beauvais dit Saint-Joseph, Joseph-Xavier. Soldat au régiment de Languedoc, compagnie de Vaudray en 1755, engagé le 5 mai 1753 comme soldat dans la compagnie de Vaudray. Il est né le 14 mai 1730 à Champagnole (St-Cyr-et-Ste-Juliette), Jura, fils de Jacques Beauvais et Anne-Marie Roussout. Il épouse Josephte Desnoyers le 21 février 1757 à Chambly. Il décède à Chambly le 26 avril 1804. Notes : Charactéristiques physiques : 5 pieds et 2 pouces, les cheveaux et sourcils châtains, les yeux gris bleu, le nez et la bouche petite, le visage plein, une cicatrice à côté de l'œil droit. (239) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def anti_vowel(text): | |
vowels = ["A", "a", "E", "e", "I", "i", "O", "o", "U", "u"] | |
anti = [] | |
for i in text: | |
if i in vowels: | |
pass | |
else: | |
anti.append(i) | |
return "".join(anti) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
score = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, | |
"f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3, | |
"l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1, | |
"r": 1, "u": 1, "t": 1, "w": 4, "v": 4, "y": 4, | |
"x": 8, "z": 10} | |
def scrabble_score(word): | |
word = word.lower() | |
tally = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5] | |
def print_grades(grades): | |
for grade in grades: | |
print grade | |
def grades_sum(grades): | |
total = 0 |