Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ch03-lists-tuples/e13b1_namedtuple_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def format_sort_records(list_of_tuples):
output = []
template = '{last:10} {first:10} {distance:5.2f}'
for person in sorted(list_of_tuples, key=operator.attrgetter('last', 'first')):
output.append(template.format(*(person._asdict())))
output.append(template.format(**(person._asdict())))
return output
2 changes: 1 addition & 1 deletion ch03-lists-tuples/e13b2_sorted_movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def sort_movies():
output = []
template = '{0:30} {1:3} {2:20}'
for one_movie in sorted(MOVIES, key=operator.itemgetter(FIELDS[sort_by])):
output.append(template.format(*one_movie))
output.append(template.format(**one_movie))
return output

print(f'No such field {sort_by}')
2 changes: 1 addition & 1 deletion ch03-lists-tuples/e13b3_sorted_movies_multifield.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def sort_movies_multifield():
template = '{0:30} {1:3} {2:20}'
for one_movie in sorted(MOVIES, key=operator.itemgetter(*[FIELDS[field_name]
for field_name in sort_by])):
output.append(template.format(*one_movie))
output.append(template.format(**one_movie))
return output

print(f'No such field {sort_by}')