python - Using __str__ after sorting -
i've created list using class photo , sorted list. want print string representation first 3 items in list. code i've written, end blank version of string (like "title:" instead of "title: volcano"). going wrong?
here's bit of code issue:
sorted_p = [] d in sorted(p_i, key = photo.t_c): sorted_p.append(photo(d)) d in sorted_p[:3]: print(d)
Comments
Post a Comment