Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import sys
- import importlib
- import time
- OUTPUT = '\033[95m'
- ERROR = '\033[91m'
- RESULT = '\033[92m'
- ENDC = '\033[0m'
- def output(colorc, text):
- print(colorc + text + ENDC)
- def main():
- name = 'p%03d' % int(sys.argv[1])
- output(OUTPUT, 'Running %s.main() ...' % name)
- module = importlib.import_module(name)
- starttime = time.time()
- result = module.main()
- endtime = time.time()
- output(RESULT, 'Result: %s' % str(result))
- output(RESULT, 'Time: %.3f s' % (endtime - starttime))
- if __name__ == '__main__':
- if len(sys.argv) != 2:
- output(ERROR, 'Missing argument: problem number!')
- else:
- main()
Add Comment
Please, Sign In to add comment