import operator
sortedlist = sorted(reader, key=operator.itemgetter(3), reverse=True)
or use lambda
sortedlist = sorted(reader, key=lambda row: row[3], reverse=True)
More Related Contents:
- Simple CSV to XML Conversion – Python
- Python Parse CSV Correctly
- Parsing a pipe-delimited file in Python
- How can I convert JSON to CSV?
- Pythonic way to check if a list is sorted or not
- How to avoid Python/Pandas creating an index in a saved csv?
- datetime dtypes in pandas read_csv
- How do I convert this list of dictionaries to a csv file?
- How to sort a list of tuples according to another list
- python – Using pandas structures with large csv(iterate and chunksize)
- pandas groupby, then sort within groups
- Merging two CSV files using Python
- How to use a custom comparison function in Python 3?
- How to read specific part of large file in Python
- Sort a part of a list in place
- How to sort IP addresses stored in dictionary in Python?
- pandas read_html ValueError: No tables found
- Parsing a YAML file in Python, and accessing the data?
- Is it possible to keep the column order using csv.DictReader?
- Load CSV file with PySpark
- Python UTF-16 CSV reader
- How to sort Counter by value? – python
- Read specific columns with pandas or other python module
- load csv into 2D matrix with numpy for plotting
- How does python and the regex module handle backslashes?
- Parsing a date that can be in several formats in python
- Pandas read_csv dtype read all columns but few as string
- How can I stop Python’s csv.DictWriter.writerows from adding empty lines between rows in Windows?
- What is this odd sorting algorithm?
- How to convert csv to json in python?