Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.