Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
Created January 30, 2018 19:44
Show Gist options
  • Save evandhoffman/3e76848345124dc39291c7cc0c02d2bc to your computer and use it in GitHub Desktop.
Save evandhoffman/3e76848345124dc39291c7cc0c02d2bc to your computer and use it in GitHub Desktop.
Read a file in and put its contents in a JSON param
import json
import sys
with open(sys.argv[1],"r") as myfile:
data=myfile.read()
myjson = { "filename": sys.argv[1], "contents": data }
print json.dumps(myjson, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment