Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Created June 2, 2012 00:24
Show Gist options
  • Select an option

  • Save rhelmer/2855906 to your computer and use it in GitHub Desktop.

Select an option

Save rhelmer/2855906 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import shlex
if len(sys.argv) != 2:
print 'Syntax: parser.py <filename>'
sys.exit(1)
filename = sys.argv[1]
with open(filename) as f:
for arg in shlex.split(f.read()):
if '=' in arg:
(key, value) = arg.split('=', 1)
print 'key: %s, val: %s' % (key,value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment