Skip to content

Instantly share code, notes, and snippets.

@liori
Created May 21, 2014 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liori/0d7018295c23771d2280 to your computer and use it in GitHub Desktop.
Save liori/0d7018295c23771d2280 to your computer and use it in GitHub Desktop.
import csv
[…]
with open('sentences.csv', 'rb') as fh:
reader = csv.reader(fh, [… some options might be necessary …])
# at this point `reader` is an iterator that returns tuples
for sentence_id, language, sentence in reader:
if language == 'cmn': # for example, let's print all chinese sentences
print sentence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment