Skip to content

Instantly share code, notes, and snippets.

@trevershick
Last active December 11, 2015 19:29
Show Gist options
  • Select an option

  • Save trevershick/4648928 to your computer and use it in GitHub Desktop.

Select an option

Save trevershick/4648928 to your computer and use it in GitHub Desktop.
Simple Python List Comprehension Example
>>> [ (e.id, e.title) for e in Entry.objects.all() if e.status == Entry.STATUS_LIVE ]
[(5, u'Test Entry 2'), (3, u'Test Title 0')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment