comparison utils.py @ 63:dff964aa0dd5 draft

Uploaded
author greg
date Mon, 22 May 2017 11:57:35 -0400
parents f7a999b3b19c
children 45aa928ed5df
comparison
equal deleted inserted replaced
62:9eabe9e58fb5 63:dff964aa0dd5
56 56
57 def write_html_output(output, title, dir): 57 def write_html_output(output, title, dir):
58 with open(output, 'w') as fh: 58 with open(output, 'w') as fh:
59 dir_items = sorted(os.listdir(dir)) 59 dir_items = sorted(os.listdir(dir))
60 # Directories can only contain either files or directories, but not both. 60 # Directories can only contain either files or directories, but not both.
61 if os.path.isdir(dir_items[0]): 61 item_path = os.path.join(dir, dir_items[0])
62 if os.path.isdir(item_path):
62 header = 'Directories' 63 header = 'Directories'
63 else: 64 else:
64 header = 'Datasets' 65 header = 'Datasets'
65 fh.write('<html><head><h3>%s: %d items</h3></head>\n' % (title, len(os.listdir(dir)))) 66 fh.write('<html><head><h3>%s: %d items</h3></head>\n' % (title, len(os.listdir(dir))))
66 fh.write('<body><p/><table cellpadding="2">\n') 67 fh.write('<body><p/><table cellpadding="2">\n')