Trying to sort a csv integer column but it get sorted alphabetically.
This sorts alphabetically not numerically
sortedChanels = sorted(reader, key=operator.itemgetter(4), reverse=False)
Tried
sortedChanels = sorted(reader, key=lambda t: int(t(4)))
get error
TypeError: 'list' object is not callable
sortedChanels = sorted(reader, key=lambda row: int(row[4]), reverse=False)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.