Skip to content

Instantly share code, notes, and snippets.

@DevanR
Created September 12, 2018 20:39
Show Gist options
  • Save DevanR/73db4e301a235170792a167bd826b583 to your computer and use it in GitHub Desktop.
Save DevanR/73db4e301a235170792a167bd826b583 to your computer and use it in GitHub Desktop.
Converting tuples to dicts
tuple = ('71.201.176.194', '-', '-', '26/Feb/2008:10:30:08 -0600',
'GET', '/ply/ply.html', 'HTTP/1.1', '200', '97238')
colnames = ('host','referrer','user','datetime',
'method','request','proto','status','bytes')
dict = (dict(zip(colnames,t)) for t in tuples)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment