from syshelp import get_args # This is in my python-libs repo. def cat(filename): '''Print the contents of a given file.''' with open(filename) as lines: for line in lines: print(line, end='') if __name__ == '__main__': args = get_args('EXACTLY', 1) if args: cat(args[0])
from email_parser import * from syshelp import get_args def get_addresses(filename): '''Given a filename, gets and prints email addresses it finds.''' emails = parse_email(filename) for email in emails: print(email) if __name__ == '__main__': filenames = get_args('AT_LEAST', 1) # AaD Day 04! for filename in filenames: get_addresses(filename)
DIM = 600 MAG = 3 # Increase this to raise the magnification on the ecosystem. SIZE = [DIM, DIM + 50] screen = pygame.display.set_mode(SIZE) # Used to manage how fast the screen updates. clock = pygame.time.Clock() # Set onts, colours, and text positions. FSIZE = 35 font = pygame.font.Font(None, FSIZE) XPOS = 10 YPOS = DIM + 20 BLACK = (0, 0, 0) WHITE = (255, 255, 255) # Create the Ecosystem. args = get_args('AT_LEAST', 0) if args: eco_type = args[0] present = Ecosystem(DIM / MAG, args[0]) else: present = Ecosystem(DIM / MAG) # The work. done = False run = True # Used for pausing. while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.KEYDOWN: if event.key == pygame.K_q: