In [1]:
% cat 144bbs2.txt | python egrep.py "[0-9]" | python line_count.py
In [2]:
% cat the_bible.txt | python most_common_words.py 10
In [3]:
from collections import Counter
def get_domain(email_address):
return email_address.lower().split("@")[-1]
with open("email_address.txt", "r") as f:
domain_counts = Counter(get_domain(line.strip()) for line in f if "@" in line)
domain_counts
Out[3]:
In [4]:
import csv
result = []
with open("tab_delimited_stock_prices.txt", "r") as f:
reader = csv.reader(f, delimiter="\t")
for row in reader:
date = row[0]
symbol = row[1]
closing_price = float(row[2])
result.append([date,symbol,closing_price])
result[:5]
Out[4]: