def print_object_info(info, key): gb = groupby(key, info) for header in sorted(gb, key=str): print(header) for f_info in sorted(gb[header], key=getter('filename')): for data in sorted(f_info): if data == key: continue if f_info[data] is None: continue print(' %s: %s' % (data, f_info[data])) if len([i for i in f_info if f_info[i] is not None and i != key]) > 1: print() print()
def print_object_info(info, key): output_string = "" gb = groupby(key, info) for header in sorted(gb, key=str): output_string += header + "\n" for f_info in sorted(gb[header], key=getter('filename')): for data in sorted(f_info): if data == key: continue if f_info[data] is None: continue output_string += ' %s: %s\n' % (data, f_info[data]) if len([i for i in f_info if f_info[i] is not None and i != key]) > 1: output_string += '\n' output_string += '\n' return output_string