Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/sort.py

Last active May 31, 2016
Embed
What would you like to do?
【Python】PythonでCSVファイルをソートする方法
import csv, operator
with open("file.csv", "r") as f:
reader = csv.reader(f)
# operator.itemgetter(0)で一列目をソート
print sorted(reader, key=operator.itemgetter(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment